[Pas2js] lambda keyword feature request

Mattias Gaertner nc-gaertnma at netcologne.de
Sun Jan 21 10:00:55 CET 2018


On Sat, 20 Jan 2018 21:07:15 -0600 (CST)
warleyalex via Pas2js <pas2js at lists.freepascal.org> wrote:

> It would really nice Pas2JS introduce the Lambda syntax, the lambda
> expression syntax is similar to C# syntax with "lambda" keyword in front to
> make it less of an operator soup.
> 
> something like
> 
> DoSomething(
>    lambda (param1, param2: String): String
>       DoSomethingElse(param1);
>       Result := ComputeSomething(param2);
>    end,
>    lambda(err: JSValue)
>        WriteLn(err);
>    end);
> 
> Lambdas are currently capable of compile-time type-inference, ie. they are
> strongly-typed and can be used as less verbose alternatives to the
> “anonymous methods” syntax.

Where are they better than the Delphi anonymous functions?

Mattias


More information about the Pas2js mailing list