On 14.02.2012 22:03, Marco van de Voort wrote:
In our previous episode, Sven Barth said:
in a container, the same container could be used.
Such logic unnecessarily complicates the compiler. Generics are already
troublesome enough.
Afaik it was the main reason to implement generic constraints in Delphi (like
.NET)?
Constraints allow the compiler to infer further information on the given
types to improve e.g. type checking when parsing the generic, but they
won't magically allow the compiler to not duplicate code (in theory it
would be possible to do something like Java's generics for cases where
the constraints are for descendants of TObject or IInterface, but in my
opinion the tradeoffs (increased compiler complexity) are not worth it).
Regards,
Sven
_______________________________________________
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal