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

Mark Morgan Lloyd markMLl.fpc-devel at telemetry.co.uk
Sat Jan 26 20:13:52 CET 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".

Nice, but I've got reservations about making tuples compatible with 
dynamic arrays (or at least, any more compatible than a dynamic array is 
with a normal array).

I also note Alexander's earlier

 >   ZEROES: array [1..10] of Integer = (0, 0, ..., 0);
 > ...
 > (x, y, z) := Tuple(ZEROES);

which I'm afraid I really don't like since that sort of thing is too 
easily misinterpreted as making the language indeterminate. I'd vote for 
having implicit compatibility between a single element and a tuple i.e. 
something like

 > (x, y, z) := Tuple(0);

provided that x, y and z are all the same type. Granted that the same 
effect can be had by overlaying the assignment operator but this would 
save having to use per-element assignment or an intermediate array.

-- 
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