Is the compiler supposed to accept this?

Timon Gehr timon.gehr at gmx.ch
Wed Jul 10 14:49:30 PDT 2013


On 07/10/2013 11:32 PM, Brian Schott wrote:
> On Wednesday, 10 July 2013 at 21:16:30 UTC, Timon Gehr wrote:
>> // (parameters) => expression ?
>>
>> In any case, please consider that it actually makes no sense to
>> restrict the expressiveness of the type signature based on how the
>> function body is specified. (Why on earth should one have to use the {
>> return expression; } syntax just in order to be able to assert that no
>> context pointer is required?)
>>
>> 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.

Yes, you said that. What I do not understand is why. I think common 
sense would mandate that it should be valid syntax.

> Can any of the DMD devs clear up if this is intended?

This is the relevant pull:

https://github.com/D-Programming-Language/dmd/commit/675898721c04d0bf155a85abf986eae99c37c0dc



More information about the Digitalmars-d mailing list