On 15.04.2013 20:17, Mark Morgan Lloyd wrote:
Jonas Maebe wrote:
On 15 Apr 2013, at 16:48, Mark Morgan Lloyd wrote:

I was having a bit of fun earlier while waiting for a call. Am I
correct in believing that something like

type    t1= array of integer;

var     a1: t1;
    x: integer;

a1 := [1,2,3,4,5];

can't be done at present, irrespective of any custom definition of
the := operator?

Maybe if you overload the assignment operator for "t2=set of byte" to
"t1" assignments, but I'm not certain. It's definitely not something
we explicitly support.

That's a good point, although obviously ordering would be lost. After
I'd tinkered with it for a while I concluded that it was probably
related to the discussion of tuples a few weeks ago.

Not really.

Also the principial components are already available in the compiler so in theory (!) one could implement this. Array constructors (the "[...]" notation) is already used for open array parameters and array initialization is already possible for named dynamic arrays in the form of the delphi compatible "TMyDynamicArrayType.Create(1, 2, 3, 4, 5);" (yes, I think this is a bad choice of implementing it and comes probably from Delphi.NET :( )

Regards,
Sven

_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to