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

Arioch AriochThe at gmail.com
Thu Aug 30 11:11:50 CEST 2012


>> "var x: array[0..10] of integer; "  also is twice lazy.

>> type 
>>     SomeEnumSemanticName = 0..10;
>>     SomeEnumMapSemanticName = array[SomeEnumSemanticName] of integer;
>> var x: SomeEnumMapSemanticName;

> Except that not defining a distinct type emphasises that the array is 
> only being declared once, 

Same for closures, exactly.
The function is represent some primitive action or criteria that is not
worth re-using and clattering namespace in both compiler and developer.

More so, i believe that holds for all named/non-named entities.
Be it array, value, function of if/while condition, etc

The thing that is not named is small, with narrow use span, and is expected
to be recognized and read by human as some kind of "reading atom"
The thing named is more about architecture and documentation.


> and is not being passed around as a parameter. 

Be that the case - there would be no Open Array parameters.
//well, i just want to say my opinion here. I frankly don't want arguing yet
another topic  //

> So I'd suggest that there are cases where the first example is 
> appropriate, except obviously that that ..10 is rarely if ever acceptable.

if 10 is unacceptable then so is 0.
one should rather explicitly name type for (0..10) rather than two constants
for 0 and for 10.



--
View this message in context: http://free-pascal-general.1045716.n5.nabble.com/Delphi-s-anonymous-functions-in-Free-Pascal-tp4911527p5711062.html
Sent from the Free Pascal - General mailing list archive at Nabble.com.



More information about the fpc-pascal mailing list