On 10/09/2015 05:19 AM, Ola Fosheim Grøstad wrote:
> On Friday, 9 October 2015 at 04:15:42 UTC, Ali Çehreli wrote:
>> Go feature where you just type a dot after a pointer and the language
>> is so great that it works! You don't need to type (*p).member. Isn't
>> Go awesome!
>>
>> I responded "yep, it's a great feature and those gostards will never
>> admit that they took that feature from D." (There is probably earlier
>> precedence but it felt great to say it to my friend. :) )
>
> Just about all higher languages does this, since the reference type does
> not have members. Simula too.
>
> But this unfortunately breaks down when you add smart-pointers, which
> makes this approach unsound since pointer-type members collide with
> object members.

Yeah... Type properties is another example for D: .sizeof and .alignof are not propagated to the pointee and .stringof is not propagated to the type of the pointee.

Similarly, for class references, one must remember to use __traits(classInstanceSize) and std.traits.classInstanceAlignment. (Yes, I notice the inconsistency. ;) )

Ali

Reply via email to