Bug 21187 – `.tupleof` should be directly usable as alias

Status
NEW
Severity
enhancement
Priority
P4
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2020-08-22T01:42:34Z
Last change time
2024-12-13T19:11:12Z
Keywords
pull
Assigned to
No Owner
Creator
basile-z
Moved to GitHub: dmd#19776 →

Comments

Comment #0 by b2.temp — 2020-08-22T01:42:34Z
.tupleof solving generates a tuple for each use, so aliasing, without using an AliasSeq, should work --- struct F { alias thisTup = typeof(this).tupleof; int a,b,c,d; void test() { static foreach (i; 0 .. 4) thisTup[i] = i + 1; assert(a == 1); assert(b == 2); assert(c == 3); assert(d == 4); } } void main() { F().test(); } ---
Comment #1 by dlang-bot — 2020-08-22T01:58:02Z
@NilsLankila created dlang/dmd pull request #11604 "fix issue 21187 - allow to alias directly `.tupleof`" fixing this issue: - fix issue 21187 - allow to alias directly `.tupleof` It is actually not a good idea to use `.tupleof[index]` because the whole tuple is regenerated for each use. But for now `alias id = T.tupleof` is not allowed which is odd. https://github.com/dlang/dmd/pull/11604
Comment #2 by robert.schadek — 2024-12-13T19:11:12Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/19776 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB