Am 05.05.2017 21:19 schrieb "Mark Morgan Lloyd" <
markmll.fpc-pas...@telemetry.co.uk>:
>
> On 04/05/17 22:30, Sven Barth via fpc-pascal wrote:
>>
>> Hello together!
>> Since revision 36105 FPC now supports the use of array constructorsusing
the "[...]" syntax inside ordinary code blocks like Delphi doessince - I
think - XE8. And yes, even nested ones are supported (take alook at
$fpcdir/tests/test/tarrconstr5.pp for a bit of inspiration).
>> Considering that this changed how "[...]" is handled I'd like you all
totest whether your existing code still works (especially if it's
dealingwith sets!) and to try this new feature to see if there are any
problemsthat our testsuite doesn't cover yet.
>>
>> If you report bugs, then please attach the tag "array constructors".
>
>
> Ah yes, /very/ nice :-)
>
> I append a chunk of fun code, which as it stands needs separate functions
per rank (i.e. for 1 dimension, 2 dimensions and so on). Can these be
rationalised using generics?

Generics are only useful as long as you can use the same code for different
types. E.g. if you replace the Writeln inside the loop for t1's print with
Print(a[i]) then you could at least generalize the print functions.
Operators however would need you to stuff them into a record as only then
you could define generic operators that would work on that record type.
Alse the code of your addition operators differs with the types so that
would not help, at least not as is.

Regards,
Sven
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to