[fpc-devel] RFC: Support for new type "tuple" v0.1

Michael Van Canneyt michael at freepascal.org
Sun Jan 27 20:26:35 CET 2013



On Mon, 28 Jan 2013, Alexander Klenin wrote:

> On Mon, Jan 28, 2013 at 4:19 AM, Michael Van Canneyt
> <michael at freepascal.org> wrote:
>> Define an iterator type/operator.
>>
>> - No interface
>> - No 'specially named function' in the class. The iterator should be
>> separate from the class.
>> Now they promoted 1 function with a special name to a special status:
>> 'GetEnumerator'
>
> Ah, you mean that FPC's "operator Enumerator" is better?
> I agree, but the difference is not too great.

It never is. It is all in details.

>
>> All identifiers should be equal for the law :-)
> I know only two languages with such extreme disdain for reserved words:
> Forth and, to a lesser extent, Lisp.
> For example, in Forth, a comment (!) is not a built-in construct,
> but a word (Forth's analog of procedure) defined in standard library.
>
>
>> Which begs the question why you didn't use a record to begin with.
>>
>> I still do not see why the enumerator could not simply return a record
>> record
>>   key : tkey;
>>   value : tactualtype
>> end;
>>
>> for r in myclass do
>>   begin
>>   Writeln(r.key);
>>   With r.value do
>>   end.
>
> the point of my tuples proposal is to do exactly that, with only a
> single change --
> allow to *also* write loop as
> for key, value in myclass do
>   begin
>   Writeln(key);
>   with value do
>   end;
>
> while keeping enumerator the same.

regarding syntax, we agree.

>
>> Borland did a world of good for (Object) Pascal, up to Delphi 7.
>> After that, it went seriously downhill in my opinion; Adding randomly
>> features without clear direction or regard for the
>> intent and philosophy of the Pascal language - or so it seems to me.
>> Like a ship at the mercy of the waves...
> I would rephrase slightly -- the features they added are, in
> principle, good ones.
> However, they hastily (and randomly?) copied them from other languages without a
> proper adaptation.

Yes. That is what I meant.

I have no objections to the features themselves.
Just the way the were introduced, is, to my taste, totally 
disregarding Pascal philosophy.

And I regret that heavily.

Michael.



More information about the fpc-devel mailing list