Anonymous function syntax
Timon Gehr
timon.gehr at gmx.ch
Sat Sep 24 09:45:06 PDT 2011
On 09/24/2011 01:24 PM, Alix Pexton wrote:
> What are the pros and cons of using "=>" rather than "->"?
>
> In an ideal world we might be able to use the correct "rightwards arrow
> from bar" character (u+21A6), but I'm not suggesting we try to make one
> out of the characters we can type ("|->" looks terrible).
>
> To my mind, "->" is somewhat closer to being mathematically correct,
> while "=>" reads as "implies", which is probably why lambdas in other
> languages have confused me.
>
> Is there a lexical justification for choosing "=>" over "->"?
>
> A...
Both would work, but => and -> both can read as "implies", in which case
=> is a semantic implication (a statement that the implication is true)
and -> is a mere binary boolean operator. (in languages that have this
operator, it can be very useful for formulating assertions)
More information about the Digitalmars-d
mailing list