Kevin Tew wrote:

:method subs should not be added to the namespace unless they have a :namespace flag.

Yes.

So we should fix set_pmc_keyed_str to not add :methods unless the :namespace flag is present.

Sort of. The thing is, 'set_pmc_keyed_str' isn't just storing subs in the namespace, it's also storing methods in the class. (Because everything defined with '.sub' calls 'set_pmc_keyed_str'.) So, lines 180-288 of 'set_pmc_keyed_str' are responsible for determining if a sub element should be stored somewhere besides the namespace, and lines 290 onward actually store the sub (or variable) in the namespace.

The whole 'set_pmc_keyed_str' vtable function should be refactored out into a series of helper routines. But, refactored or not, what it effectively has to do is:

[...] note that the namespace entry was inserted as a method or vtable override, maybe by setting an integer flag, and then at line 289 check the flag and return if it's true. (It can't just return immediately, because some entries are both vtable overrides and methods.)

The places where you would currently want to set an "I don't belong in the namespace" flag are lines 199, 217, 242, and 270. (Those are vtable override, method, NCI method, and multi method, respectively.)

Allison

Reply via email to