François PERRAD wrote:
Hi all,
With the following patch, I try to add two methods (tostring & tonumber)
at each Lua PMC.
With the first new test, I obtain :
Method 'tostring' not found
current instr.: '_main' pc 13 (languages\lua\t\pmc\number_10.pir:6)
What is it wrong or what have I forget to do ?
The problem is that methods are stored into e.g. 'LuaNumber' namspace
and you classname is 'number', used during methodlookup. A current
workaround would be to alias the name into the other namespace:
meth = Parrot_find_global(INTERP,
const_string(INTERP, "LuaNumber"),
const_string(INTERP, "tostring"));
Parrot_store_global(INTERP,
const_string(INTERP, "number"),
const_string(INTERP, "tostring"),
meth);
The plan is to attach the namespace aka methodhash to the class itself,
then this hackery isn't necessary anymore.
Françoi
s.
leo