Skip to content

Comments

Remove staticIota: std_experimental_typecons#6050

Merged
dlang-bot merged 1 commit intodlang:masterfrom
wilzbach:static_iota_std_experimental_typecons
Jan 22, 2018
Merged

Remove staticIota: std_experimental_typecons#6050
dlang-bot merged 1 commit intodlang:masterfrom
wilzbach:static_iota_std_experimental_typecons

Conversation

@wilzbach
Copy link
Contributor

No description provided.

@dlang-bot
Copy link
Contributor

Thanks for your pull request, @wilzbach!

Bugzilla references

Your PR doesn't reference any Bugzilla issue.

If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog.

@wilzbach wilzbach added the Review:Trivial typos, formatting, comments label Jan 22, 2018
string r;
bool first = true;
foreach (i; staticIota!(0, num))
foreach (i; 0 .. num)
Copy link
Contributor

@JackStouffer JackStouffer Jan 22, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

static foreach?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is just used to generate a string which is mixin-ed later anyways.
We could also convert args to a non-templated function, which is probably a bit faster.

Copy link
Member

@MetaLang MetaLang Jan 22, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't feel that it makes a huge difference so I'm gonna merge.

EDIT: pending auto-tester.

Copy link
Member

@PetarKirov PetarKirov Jan 23, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Always prefer runtime foreach (when possible - e.g. CTFE), as the compile-time/tuple/AliasSeq foreach and static foreach copy the AST of the loop body for each loop iteration, thereby making the compilation slower and requiring more memory.

@dlang-bot dlang-bot merged commit d4a2581 into dlang:master Jan 22, 2018
@wilzbach wilzbach deleted the static_iota_std_experimental_typecons branch January 23, 2018 01:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Merge:auto-merge Review:Trivial typos, formatting, comments

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants