Conversation
|
Thanks for your pull request, @wilzbach! Bugzilla referencesYour PR doesn't reference any Bugzilla issue. If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog. |
| foreach (endianness; AliasSeq!(Endian.bigEndian, Endian.littleEndian)) | ||
| { | ||
| import std.meta : AliasSeq; | ||
| static foreach (endianness; [Endian.bigEndian, Endian.littleEndian]) |
There was a problem hiding this comment.
Why the change from AliasSeq to an array?
There was a problem hiding this comment.
Because static foreach can unroll arrays and thus there's no need for AliasSeq anymore.
There was a problem hiding this comment.
Yes but why only this one specifically? I know most of these loops are over lists of types, but there's at least one other one that loops over a list of values.
There was a problem hiding this comment.
Then I overlooked the other case. This PR catches only 95% of the static foreach's.
Anyways, we can easily make more improvements to this. Where did you see the other list of values?
There was a problem hiding this comment.
It's not that important; I was just trying to understand why you did it for one and not the others. Looking at the other cases, however, an array can't or shouldn't be used because they're separate types.
|
BTW seeing how easy it is to replace |
|
Is there any point to using |
|
Does anyone know if |
There's a lot of code out there doing stuff like using |
AFAICT only @UplinkCoder and Sociomantic have done a bit of work on it recently. |
All the cool kids in town use
static foreach. Let's join the club.Motivation:
static foreachmakes it clear to the reader that the loop is unrolledduring compile-time.
The replacements were done semi-automatically.
I also removed the workarounds against BUG 2396 -
static foreachdoesn't seemto be affected by this as overall execution time of the entire Phobos testsuite
doesn't with this PR.
I know that this got quite large, but the changes itself are trivial.