-> and :: operators

Ali Çehreli via Digitalmars-d digitalmars-d at puremagic.com
Thu Oct 8 21:15:42 PDT 2015


On 10/08/2015 08:41 PM, Walter Bright wrote:
> These, of course, are C++ operators that are replace with the . operator
> in D. But when I translate C++ code to D, sometimes these operators get
> left behind, and sometimes I simply reflexively type them into D code.
>
> The error message coming out of dmd could be better. I suggest
> recognizing -> and :: in the lexer, and saying something like:
>
>     "The '->' operator is not in D, did you mean '.'?"
>
> Anyone want to do a PR for this? (Should be pretty straightforward.)

Semi-relatedly, a colleague who has heard many D sales pitches from me 
over the years is recently "looking at Go" and liking it very much. He 
came to me today telling me about this awesome 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. :) )

Ali



More information about the Digitalmars-d mailing list