[fpc-pascal] Re: Delphi's anonymous functions in Free Pascal

Arioch AriochThe at gmail.com
Thu Aug 30 12:00:58 CEST 2012


> Regarding this: I wish to stress that my views on lambdas or closures are
my own;

For what i understand, those are different things.
Lambdas are runtime code generators and are out of question for natively
compiled language.
Closures are not.
Maybe that is nitpicking today, since the names seems to be substituting
each other outside functional languages realm where those concepts were
born.

> But - and I think the whole compiler team shares this idea - if
implemented,
> it will be in a pascal-ish way, i.e. rather verbose.

Well, views for views.

That is Delphi way you describe. Beauty of principles.
And that would be harmingly impractical.

Closures are about concise way to express one-liners.
If you have to type 30 chars instead of 3 - their use became hard and
impractical.

This would suppress using closures for one-liners, where that are useful,
safe and enhancing code readability and composability.
That would promote their use for complex code chunks where they are
dangerous and bad.

>From personal experience, when i first time saw how pascalish is closures
implementation in Delphi i just admired the ease in which that concept was
fused into the language of very different style built upon very different
ideas. It was so elegant when reading docs, i admired it. Like probably you
do.

But that next to ruined their use in practice.

That is where i loose my consistency.

I do want Delphi and FPC have shared libraries, which mean i want FPC to
support as much Delphi syntax as feasible.
I do want generics in both and hence want FPC support Delphi generics
syntax.
I do want closures in both and... and completely cold-hearted if FP would
support Delphi syntax of them or not.

While generally i feel kind of disgust at C syntax, i have to admit that
their so-called lambdas are ugly but might be practical.




--
View this message in context: http://free-pascal-general.1045716.n5.nabble.com/Delphi-s-anonymous-functions-in-Free-Pascal-tp4911527p5711067.html
Sent from the Free Pascal - General mailing list archive at Nabble.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freepascal.org/lists/fpc-pascal/attachments/20120830/2da47539/attachment.htm


More information about the fpc-pascal mailing list