Is the compiler supposed to accept this?
Ali Çehreli
acehreli at yahoo.com
Wed Jul 10 14:48:25 PDT 2013
On 07/10/2013 02:32 PM, Brian Schott wrote:
> On Wednesday, 10 July 2013 at 21:16:30 UTC, Timon Gehr wrote:
>> The documentation is in error here.
>
> "(parameters) => expression" is mentioned in the source and I agree it's
> valid. I must have forgotton to copy-paste it.
>
> I don't agree that "function(parameters) => expression" is valid though.
> Can any of the DMD devs clear up if this is intended?
According to spec "function(parameters) => expression" is not valid.
http://dlang.org/expression.html
Lambda:
Identifier => AssignExpression
ParameterAttributes => AssignExpression
Neither of those allow 'function' or 'delegate' keyword. However, I
agree with Timon Gehr that the spec should be changed to match the
current behavior.
Ali
More information about the Digitalmars-d
mailing list