> Am 15.08.2018 um 17:29 schrieb Michael Van Canneyt: >> >> >> On Wed, 15 Aug 2018, Sven Barth via fpc-pascal wrote: >> >>>> >>>> But maybe you are using mode delphi ? If so, try separating out the >>>> object >>>> definition in a separate unit which is not compiled in delphi mode. >>> A global operator won't help at all as (currently) the operator won't >>> be visible during the specialization. Only if the operator is visible >>> during the *generic's* declaration it would be picked up. >> >> That is contrary to the class operator, which is also only visible >> during >> specialization, after all. >> >> Is there a reason for this behaviour ? > The operator of a record is visible together with the record, however a > global operator is not. When specializing the unit scope of the > declaration of the *generic* is restored thus no helpers or global > operators of the current scope are visible except they are part of the > type parameter. > I do want to try to change this in the future, but I need to be careful > to not open a different can of worms (as Delphi doesn't do it this way).
Purely reasoning in terms of data structures: I would think you 'attach' operators to the type for which they are defined ? If the 'attach' link structure contains the unit in which the operator definition resides, you can check whether this unit is visible, and if yes, the operator is 'usable'. Michael. _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal