-> and :: operators
Ola Fosheim Grøstad via Digitalmars-d
digitalmars-d at puremagic.com
Fri Oct 9 05:19:53 PDT 2015
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.
So C++ actually got this right by requiring explicit
dereferencing.
More information about the Digitalmars-d
mailing list