www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 13451] New: Lambda syntax with explicit return type not

https://issues.dlang.org/show_bug.cgi?id=13451

          Issue ID: 13451
           Summary: Lambda syntax with explicit return type not documented
           Product: D
           Version: D2
          Hardware: All
               URL: http://dlang.org/grammar.html#Lambda
                OS: All
            Status: NEW
          Keywords: spec
          Severity: normal
          Priority: P1
         Component: websites
          Assignee: nobody puremagic.com
          Reporter: briancschott gmail.com
            Blocks: 10233

---
fp = function int(int a) => a;
---

This code is accepted by DMD but cannot be produced by the grammar:

FunctionLiteral:
    function Type(opt) ParameterAttributes(opt) FunctionBody
    delegate Type(opt) ParameterAttributes(opt) FunctionBody
    ParameterAttributes FunctionBody
    FunctionBody
    Lambda

ParameterAttributes:
    Parameters
    Parameters FunctionAttributes

Lambda:
    Identifier => AssignExpression
    function(opt) ParameterAttributes => AssignExpression
    delegate(opt) ParameterAttributes => AssignExpression

--
Sep 09 2014