Hi,
I'm trying to extend the standard Hash PMC, if it returns "None",
because there was no value at the specified key, then I want to override
this behaviour by returning something else. In order to do that, I
should know what methods are called. That's where I'm running into
trouble. I can just do a
fprintf(stderr, "<signature>");
to check if the method is called.
Now, when I do:
P0 = new .Hash
P1 = P0[42]
and
I0 = 42
P1 = P0[I0]
the method
PMC *get_pmc_keyed_int(INTVAL)
gets called (as I would expect). So, I can just override this method,
and if the return value of SUPER() is "None", then I return my own stuff
("nil" to be exact). So, when I try to index the hash with a string like:
P1 = P0["hi"]
or
S0 = "hi"
P1 = P0[S0]
I would expect the method
PMC *get_pmc_keyed_str(STRING *)
gets called. It seems to me this is not the case. The same is true for
indexing with a PMC:
P2 = new .Key
P2 = "hello"
P1 = P0[P2]
This should call (I think)
PMC *get_pmc_keyed(PMC *)
Well, that would be logical, right? (I can't find any other suitable
methods in hash.pmc that could be called, because the return value
should be a PMC)
Anybody an idea what I'm doing wrong here?
Thanks,
klaas-jan