function declaration in parameter list

Jay Norwood jayn at prismnet.com
Tue Apr 30 23:12:53 PDT 2013


On Saturday, 6 April 2013 at 14:50:50 UTC, Bruno Medeiros wrote:
> Interesting thread. I've been working on a hand-written D 
> parser (in Java, for the DDT IDE) and I too have found a slew 
> of grammar spec issues. Some of them more serious than the ones 
> you mentioned above. In same cases it's actually not clear, or 
> downright wrong what the grammar spec says. For example, here's 
> one off of my notes:
>
>   void func(int foo() { } );
>
> The spec says that is parsable (basically a function 
> declaration in the parameter list), which makes no sense, and 
> DMD doesn't accept.

I'm wondering about the statement above, over in digitalmars.D
thread, that the declaration makes no sense.

http://dlang.org/expression.html#FunctionLiteral has
void foo(int function(int) fp);

Is/was void foo(int fp(int){}); intended to be accepted as an
alternate form of that declaration?


More information about the Digitalmars-d-learn mailing list