templating opEquals/opCmp (e.g. for DSL/expression templates)

Nicholas Wilson iamthewilsonator at hotmail.com
Thu Feb 14 01:54:17 UTC 2019


On Wednesday, 13 February 2019 at 16:07:06 UTC, H. S. Teoh wrote:
> On Wed, Feb 13, 2019 at 12:12:17PM +0000, jmh530 via 
> Digitalmars-d wrote:
>> On Wednesday, 13 February 2019 at 02:37:50 UTC, H. S. Teoh 
>> wrote:
>> > [snip}
>> > 
>> > Haha... yeah, I *thought* the choice of => for lambda syntax 
>> > was not a good idea.  But people seemed to love it at the 
>> > time, what can I say?  :-/
>> > 
>> 
>> What do you prefer instead? Can C++'s -> cause similar 
>> ambiguities?
>
> I'll admit, I've never really thought too hard about it.  But 
> the main idea is to choose something that can't be confused for 
> something else. Since -> isn't a token in D, it seems to be a 
> viable candidate. But it might be confusing for the, *ahem*, 
> droves of C++ coders who just can't wait to migrate to D. ;-)

-> is overloaded in C++ as:
  a->b as (*a).b
  a->b an overloadable operator
  a-->b ("goes to")
auto func() -> T (trailing return)
and I'm sure some others that I've missed.

Being confused is par for the course, I think they'd be right at 
home ;)



More information about the Digitalmars-d mailing list