On Fri, 22 Apr 2011, Florian Klämpfl wrote:

Am 22.04.2011 13:32, schrieb michael.vancann...@wisa.be:


On Fri, 22 Apr 2011, Florian Klämpfl wrote:

   (I suspect this is why it is possible to add type restrictions in the
Delphi/.Net implementations)

2. If I have my own overloaded version of '+' for a record, the above
means that it
   cannot ever be used for generics, while it will be used for all my
other code.

Say I define a type, and decide not to put the operators inside the
record,
for whatever reason. I am happily unaware of generics. Along comes an
afficiniado of generics, and wants to use my type in generics, but hits
the above problem. He is stuck.

No. He can define a record helper operator.

Which then simply repeats what I already had ? Very efficient :-)

Speedwise it makes no difference. The difference is to have simple rules
which symbols are defined during specialization.

I was not talking about speed efficiency :)

I understand the problem; However, I see no logical reason why you would 'see' a helper, when specializing, and 'not see' an operator which does the same. Both identifiers (thats what they are, deep down) are in scope at the time of specialization. If you can see the one, why not the other ?

There may be implementation difficulties for the operator, but then these should be solved.

Michael.
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to