On 25.01.2013 23:41, Alexander Klenin wrote:
On Sat, Jan 26, 2013 at 9:27 AM, Sven Barth <pascaldra...@googlemail.com> wrote:
Regarding tuples:
http://wiki.oxygenelanguage.com/en/Tuples
I know, but I consider this particular implementation an unpleasant example of
"no need to change the language -- lets do it in the library" philosophy.
Just look:
The Tuple type is a set of generic types with 1 up to 7 generic parameter types
for the value types.
There also is an 8th Tuple type of which the 8th parameter type has to be
another tuple.
I mean less the implementation specific details, but more the syntax
they chose:
=== example begin ===
TTestTuple = tuple of (Integer, String, TObject);
var
t: TTestTuple;
i: Integer;
s: String;
o: TObject;
begin
t := (42, 'Hello World', TObject.Create); // ok, this can be
considered nightmarish syntax again... (see below)
(i, s, o) := t;
// and yes this could also provide the possibility for multiassignments
(i, s, o) := (42, 'Hello World', TObject.Create);
end;
=== example end ===
The only thing I have a problem with is to use "(...)" as the syntax
element for tuples... e.g. is "(42)" an integer or a "tuple of
(Integer)"? We'd need to either enforce that "tuple of (...)" needs an
element count > 1 or that "tuple of (SomeType)" is assignment compatible
to just "SomeType" (we'd need something like this, because of backwards
compatibility).
Regards,
Sven
_______________________________________________
fpc-devel maillist - fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel