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

Mark Morgan Lloyd markMLl.fpc-devel at telemetry.co.uk
Sat Jan 26 21:09:21 CET 2013


Michael Van Canneyt wrote:
> On Sat, 26 Jan 2013, Sven Barth wrote:
> 
>> Hello together!
>>
>> Based on the results of the "for-in-index" thread I've decided to come 
>> up with a draft for the Tuple type which is thought by many people to 
>> be a better alternative to "for-in-index".
>>
>> Please note the following points:
>> * This is not the final specification for Tuples and thus open to 
>> discussion (there are still some issues with this draft that need to 
>> be solved)
>> * I won't implement this feature myself (at least not in the near 
>> future) as I have other topics on my list (most importantly generics 
>> once type helpers are commited), so Alexander is free to give the task 
>> for implementation to his student.
> 
> 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;

Iff a tuple contains elements of the same type and if tuples with this 
restriction are compatible with arrays, wouldn't this behaviour be implicit?

-- 
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]



More information about the fpc-devel mailing list