Florian Klaempfl wrote:
Graeme Geldenhuys schrieb:
Hi,
What are your feelings about the use of Variants? I'm debating this
in another NG and would like some outside opinion.
My personal opinion on Variants:
Variant based code is a nightmare to maintain. Just let somebody else
extend some variant based code. How should he know what a variant could
contain at a certain place?
Why stop at variants? Undocumented code IS a nightmare.
Such extensions are simply very error prone
to rte because of type mistaches.
nonsense. You easily get to check types, even before any automatic
casting. Variants are a a union struct (C talk here) with automatic
helper routines IF needed.
Variants are a step back to assembler
level: there you work also basically with typeless memory locations and
other people have to guess what a memory location could contain.
They aren't typeless at all, part of the structure indicates the type!
Pascal can check the type AND cast the type IF you want it to and it is
needed.
They are only slow if the type needs casting, in which case you were
going to have ot cast it anyway.
Sam
_________________________________________________________________
To unsubscribe: mail [EMAIL PROTECTED] with
"unsubscribe" as the Subject
archives at http://www.lazarus.freepascal.org/mailarchives