Is the compiler supposed to accept this?

Timon Gehr timon.gehr at gmx.ch
Wed Jul 10 14:16:29 PDT 2013


On 07/10/2013 07:47 PM, Brian Schott wrote:
> There are severel comments in the part of the dmd front end that show
> the syntax that the parser is looking for. Here's a listing:
>
> // function type (parameters) { statements... }
> // delegate type (parameters) { statements... }
> // function (parameters) { statements... }
> // delegate (parameters) { statements... }
> // function { statements... }
> // delegate { statements... }
> // (parameters) { statements... }
> // { statements... }
> // identifier => expression
>
> Based on the fact that "function (parameters) => expression" isn't
> written out like the others,

You mean, like some others.

> I'm going to file an [...] bug for this.

// (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.


More information about the Digitalmars-d mailing list