[Issue 19036] .tupleof order guarantee

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Jul 4 11:49:52 UTC 2018


https://issues.dlang.org/show_bug.cgi?id=19036

--- Comment #5 from Guillaume Lathoud <gsub at 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

--


More information about the Digitalmars-d-bugs mailing list