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

michael.vancanneyt at wisa.be michael.vancanneyt at wisa.be
Thu Aug 30 10:20:09 CEST 2012

On Thu, 30 Aug 2012, Arioch wrote:

> Ralf A. Quint wrote
>> At 12:09 AM 8/30/2012, michael.vancanneyt@ wrote:
>>> They are IMHO a negation of what pascal stands for. If your programming
>> +1
> Well, the same should be told about everything modern pascal is.
> Open and dynamic arrays, pointer math, objects, generics, even units.
> It was all breaking the initial Pascal strictness and rigidness.

Only pointer math breaks rigidness. The others do not, they enhance it.

Pascal is about readable, clearly structured, strongly typed code.

> Because what was counted "large blocks" deserving their own explicit naming
> back then - now seems trivial small detail.
> Generics are alien to Pascal no more no less than closures.

Exactly. If it had been up to me, they would not have been included either.

Till now, I've seen only 1 actual use of generics in general component code, 
which kind of supports my theory that the only thing they are useful for is 
to create a list and collection kind of classes that do not need typecasts.
which I think is too little justification, because that could have been
achieved differently IMHO.

I started to use lambda functions in Javascript, where they are ubiquitous. 
Except for some trivial cases, I ended up naming them anyway, so they could be reused.

I just don't see enough justification for them, given that Pascal offers
enough other structures to achieve the same effect.

Not every conceivable use case justifies a new language feature. Especially
such an abomination as lambda functions, which totally destroys readability.


More information about the fpc-pascal mailing list