Thread overview | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
|
June 28, 2018 [Issue 19036] .tupleof order guarantee | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=19036 Jacob Carlborg <doob@me.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |doob@me.com --- Comment #1 from Jacob Carlborg <doob@me.com> --- As a workaround, if your specification contains the names you could lookup the names using in the class using __traits(identifier, A.tupleof[i]). -- |
June 28, 2018 [Issue 19036] .tupleof order guarantee | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=19036 Timoses <timosesu@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |timosesu@gmail.com --- Comment #2 from Timoses <timosesu@gmail.com> --- I also have code depending on this property of tupleof (ordered as declared) in a struct. In my case the struct layout is handed to me and access to its properties/members has to be in the order the struct is layed out. If .tupleof were to change ever it would be a problem in this case. -- |
July 04, 2018 [Issue 19036] .tupleof order guarantee | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=19036 --- Comment #3 from Guillaume Lathoud <gsub@glat.info> --- Thanks for the answers. In another use case there is a class hierarchy, I also need the fields of the base class, which .tupleof does not provide, so I am not sure anymore how useful the present issue would be. (I ended up using something along this line: [__traits( allMembers, MyClass)].sort() ) Maybe the spec could simply state that .tupleof does not provide any order guarantee, as already specified for __traits( allMembers, MyClass ) and __traits( derivedMembers, MyClass ). -- |
July 04, 2018 [Issue 19036] .tupleof order guarantee | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=19036 --- Comment #4 from Jacob Carlborg <doob@me.com> --- (In reply to Guillaume Lathoud from comment #3) > In another use case there is a class hierarchy, I > also need the fields of the base class, which .tupleof does not provide, so > I am not sure anymore how useful the present issue would be. To get the fields of the base class you can upcast it and then use .tupleof. That is: (cast(Base) subclassObject).tupleof. You can also use some traits in Phobos to get the base class from a subclass. -- |
July 04, 2018 [Issue 19036] .tupleof order guarantee | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=19036 --- Comment #5 from Guillaume Lathoud <gsub@glat.info> --- (In reply to Jacob Carlborg from comment #4) > To get the fields of the base class you can upcast it and then use .tupleof. > That is: (cast(Base) subclassObject).tupleof. You can also use some traits > in Phobos to get the base class from a subclass. Thanks! Now I see that the official .tupleof example *does* rely on the proper order: https://dlang.org/spec/class.html#class_properties foo.tupleof[0] = 1; // set foo.x to 1 foo.tupleof[1] = 2; // set foo.y to 2 ...so I guess this guarantee should be made explicit. That would be the topic of the issue here. One the side: is there an easy way to concatenate two expression sequences? I am thinking of something like BaseClass.tupleof ~ ChildClass.tupleof -- |
July 04, 2018 [Issue 19036] .tupleof order guarantee | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=19036 --- Comment #6 from Jacob Carlborg <doob@me.com> --- (In reply to Guillaume Lathoud from comment #5) > One the side: is there an easy way to concatenate two expression sequences? I am thinking of something like BaseClass.tupleof ~ ChildClass.tupleof You can concatenate a tuple of types using std.typecons.AliasSeq. That would be used like this: alias a = AliasSeq!(typeof(BaseClass.tupleof), typeof(ChildClass.tupleof)); It seems it's not possible to concatenate without using "typeof". -- |
July 05, 2018 [Issue 19036] .tupleof order guarantee | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=19036 --- Comment #7 from Guillaume Lathoud <gsub@glat.info> --- (In reply to Jacob Carlborg from comment #6) > You can concatenate a tuple of types using std.typecons.AliasSeq. That would be used like this: > > alias a = AliasSeq!(typeof(BaseClass.tupleof), typeof(ChildClass.tupleof)); > > It seems it's not possible to concatenate without using "typeof". Thanks! -- |
June 15, 2021 [Issue 19036] .tupleof order guarantee | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=19036 Paul Backus <snarwin+bugzilla@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |spec CC| |snarwin+bugzilla@gmail.com -- |
July 20, 2022 [Issue 19036] .tupleof order guarantee | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=19036 Dlang Bot <dlang-bot@dlang.rocks> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |pull --- Comment #8 from Dlang Bot <dlang-bot@dlang.rocks> --- @RazvanN7 created dlang/dlang.org pull request #3346 "Fix Issue 19036 - .tupleof order guarantee" fixing this issue: - Fix Issue 19036 - .tupleof order guarantee https://github.com/dlang/dlang.org/pull/3346 -- |
July 20, 2022 [Issue 19036] .tupleof order guarantee | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=19036 Dlang Bot <dlang-bot@dlang.rocks> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution|--- |FIXED --- Comment #9 from Dlang Bot <dlang-bot@dlang.rocks> --- dlang/dlang.org pull request #3346 "Fix Issue 19036 - .tupleof order guarantee" was merged into master: - 633d7fc97321acdd71a3c01cd385d8f4166e1dca by RazvanN7: Fix Issue 19036 - .tupleof order guarantee https://github.com/dlang/dlang.org/pull/3346 -- |
Copyright © 1999-2021 by the D Language Foundation