Okey, this one made me go mad

Okey, this one made me go mad

http://pastebin.com/5PCUf12R

That snippet results in compiler error [dcc32 Error] E2506.pas(36): E2506 Method of parameterized type declared in interface section must not use local symbol 'TFooHelper'

If I move the declaration of the helper to the interface section, the code compiles. But I want (need to) hide the helper because of a posible "only 1 helper may be active"

Well I can workaround it by creating two more units, one for TFoo alone, and another one with TFooHelper
http://pastebin.com/5PCUf12R

Comments

  1. I think the compiler is right here. When the generic type is actually used, the compiler needs to be able to recompile the generic type into a concrete one and needs access to anything the generic type uses.

    ReplyDelete

Post a Comment