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

Sven Barth pascaldragon at googlemail.com
Sat Jan 26 20:41:52 CET 2013


On 26.01.2013 20:36, Sven Barth wrote:
>> After a first read, looks OK. You seem to have thought of everything
>> that needs to be described, except maybe extraction of a single element:
>>
>> b : tuple of (integer, integer);
>> a : integer;
>>
>> begin
>>    b:=(1,2);
>>    a:=b[0]; // a = 1 after this.
>> end;
>>
>> In this sense, it seems more like an array of const than as a record.
>

And I just got the following idea:

=== example begin ===

var
   t1: tuple of (Integer, Integer, Integer, Integer);
   t2: tuple of (Integer, Integer);
begin
   t1 := (4, 3, 2, 1);
   t2 := tl[2..3]; // with 1 based access t2 will be (3, 2);
   t1[3..4] := (5, 6); // t1 will now be (4, 3, 5, 6)
end;

=== example end ===

Regards,
Sven



More information about the fpc-devel mailing list