On Fri, 22 Apr 2011, Florian Klämpfl wrote:
Am 22.04.2011 12:58, schrieb Sven Barth:
No. He can define a record helper operator. The question is simple: do
we want generics behave like macros or more like .Net generics. Some
hybrid approach is imo wrong.
Before I forget it: Why do you think that a hybrid approach is wrong?
I meant a semantical hybrid approach, not technical because Users want
simply rules how things work. So the rule: "only symbols available
during generic definition time are available during specialization" is a
simple rule. Every exception like: but operators are available as well
are hard to understand for a user.
By this rule, the helper class/operator/beast you proposed in the other mail
should also not be available, because it is not known during definition.
Just as a helper is 'attached' to a type, an operator is equally 'attached'
to the type. Both can be "attached" by a third party that requires it :
all that is needed to use it is that it is in your current scope.
To me this means that if you allow the one, you should - logically - allow the
other.
(or vice versa)
that this probably presents implementation difficulties, and may require
reworking of operator overloading, I readily believe; I'm just considering
language design at the moment.
Michael.
_______________________________________________
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal