Yeah, I spent an hour trying to figure out how 'set_pmc_keyed_str'
vtable function in src/pmc/namespace.pmc precluded :methods from the
namespace before I tested it and found out that it didn't.
What do we want the final behavior to be?
I'm going to take a guess, correct me as needed.
:method subs should not be added to the namespace unless they have a
:namespace flag.
So we should fix set_pmc_keyed_str to not add :methods unless the
:namespace flag is present.
Kevin
Allison Randal wrote:
On Fri, Dec 21, 2007 at 01:30:42AM -0700, Kevin Tew wrote:
I've added parsing of :namespace to imcc, now I'm trying to figure
out what I'm suppose to do differently when :namespace is present in
a methods prototype.
I thought I was suppose to add the :method to a namespace, but that
seems to already work.
The relevant code is the 'set_pmc_keyed_str' vtable function in
src/pmc/namespace.pmc. After inserting a method or vtable override, it
used to skip the rest of the routine and so not insert the namespace
entry. Not sure when the code changed, but it doesn't particularly
matter.
What the code should 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.)
I think I must have misinterpreted some problem in the past as being
due to a missing namespace entry, when it may have been
something else. (Looking in the wrong namespace comes to mind.)
So, it looks like Parrot already does what I need as its current
default behavior.
It was set that way in the past, which may have caused an earlier
problem. But, if you don't actually need the feature now, we won't add
the flag.
Allison