[fpc-pascal] Array assignment, and not-a-number

Mark Morgan Lloyd markMLl.fpc-pascal at telemetry.co.uk
Mon Apr 15 22:31:45 CEST 2013


Sven Barth wrote:

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

Although if I understand things correctly that's for the specific case 
of a parameter passed to a procedure of function, not for the operand of 
a redefined operator such as := even though the definition looks like a 
function.

> 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 :( )

So it might be able to do it with a type helper, at the cost of looking 
like a function rather than like an ordinary assignment.

Of course one place where what I'm playing with gets hairy is in 
overlaid operator definition: I'm having to define e.g. + for a pair of 
1-D dynamic arrays, a pair of 2-D dynamic arrays and so on. If I 
understand things correctly it's not possible to define a generalised 
dynamic array parameter where the dimension (number of axes/indexes) as 
well as the rank (range of each index) is undefined.

-- 
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-pascal mailing list