Hacker News new | past | comments | ask | show | jobs | submit login

well you can already define a lambda locally right now and do the exact same thing



Almost, you can't declare a generic local lambda.

    public void Test()
    {
        // Doesn't work
        Func<A, string> lam = (A a) => a.ToString();

        // Works
        string LocalFunc<A>(A a) => a.ToString();
    }
Also I think if the local function doesn't close over any variables in the containing method then there's no additional memory allocation, whereas the lambda itself must be allocated.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: