C++ Resyntaxed

Jari-Matti Mäkelä jmjmak at utu.fi.invalid
Thu Mar 13 15:50:27 PDT 2008


On Thu, 13 Mar 2008, bearophile wrote:

> renoX:
>> Easy: use func param -> return for functions and delegate param -> return, not just -> alone (or maybe -> alone is for functions)..
>
> Maybe this for functions
> int -> float
> and this for delegates:
> int => float

> And maybe this one for closures (but that syntax for closures may suffice) :-)
> int ==> float

Closures? You mean for functions that heap allocate the context when scope 
exits? I thought D does that automatically now.

> It's shorter :-)
> Note that the same ->/=> syntax can be used to define anonymous functions too (it's a syntax like C# one).

I guess Landin had the -> syntax in mind already in 60s (and possibly 
someone else before him). Many functional languages have used it ever 
since. It's a shame that most popular languages never started to use it 
(except now). Those who do not learn from history are doomed to repeat 
it..



More information about the Digitalmars-d mailing list