Sven Barth wrote:

We're heading off topic, no disrespect to Bernd intended.

With the compiler as it stands, I've been able to define e.g. <variant> + <dynamic array>, define a variant constant "reduce", and then do e.g. a := reduce + b where b is an array. Which was all fine except that (at least when I last looked) there wasn't a compact notation for initialising a dynamic array, i.e. no b := (1, 2, 3, 4).

Interesting idea to "misuse" a Variant for that :)

It was the only numeric type I could get to work that way, but I didn't try e.g. a type defined as an empty record which might be more appropriate.

If you have a named dynamic array type then you can use "TMyArrayType.Create(1, 2, 3, 4)", though this only exists in Trunk (reason: Delphi compatibility). My idea was to implement a Pascal like way for this somewhen which would use "b := [1, 2, 3, 4]" (because in code sections arrays are normally done using "[...]" instead of "(...)" (which is used in constant sections)).

[Nod] Yes, the hack I described above was done at about the time we were discussing that sort of thing which was also when I came across Vector Pascal... which actually has some nice ideas.

--
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]
_______________________________________________
fpc-devel maillist  -  [email protected]
http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply via email to