Am 04.03.2013 22:41 schrieb "Martin" <laza...@mfriebe.de>:
>
> On 04/03/2013 19:16, Alexander Klenin wrote:
>>>
>>> See above. The omission "of Result :=" is IMHO not desirable.
>>
>> Are you sure? Note that *any* useful single-statement function will
>> start exactly like this
>
> If a = x then Result := 4 else Result := 5;
>
> Single statement, but starts different.  And is useful.
>
> But that isn't why I replied again.
>
> Reading the shortened version versus the full anonymous procedure (with
var, const, type....) and I realized, that thi's a 2 entirely different
things.
>
> The above is NOT an anonymous function. It is a reference to a term.
> I am not voting for it, but IF it was done, then it should have its own
keyword.
>
> It would not allow for var, type or anything (and it will only work for
functions, not procedures.)
>    a.sort(LambdaTerm TMyCompare do x > y)
> or
>    a.sort(TermRef TMyCompare(x > y) )

This is basically what my idea behind the lambs syntax was: only one
expression or statement and no variable, type or constant declarations. And
for more complex use case there are either Delphi's anonymous functions or
FPC's nested procedures/functions.

> anonymous function, then would *always* require
>    a. sort( Function; prototype TMyCompare; [var ...] begin ... end )
>
> the protopybe (modifier) could work for named procedures too. (THey would
be required NOT to have any params)
>   Function Foo; prototype TMyCompare;
>   [var ...]
>   begin ... end

Ah! Now with the named example I understand the use of the ";" after the
"function"...

Regards,
Sven
_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply via email to