I can override __get_string() -- and it's tested in t/pmc/delegate.t.
Is __find_method() workable yet? If not, how would I go about adding
it?
t/pmc/delegate.t looks like the right place for it, but I distrust that,
for example, the test for __get_string() actually tests what it should
test. I'd expect to need to define an entirely new class.
Of course, if I'm misunderstanding PDD15 altogether, that's cool too.
-- c
That's a cut'n'paste error in pdd15 - at least now. All vtable methods,
which are explicitely in ParrotClass/ParrotObject aren't overridable.
You might have a look at classes/parrotobject.c:
...
Parrot_delegate_clone,
Parrot_ParrotObject_find_method,
Parrot_delegate_get_integer,
Parrot_delegate_get_integer_keyed,
...
But there will be of course some AUTOLOAD scheme. And you can simulate
one with exceptions:
.sub _main
$P0 = newclass "A"
$I0 = find_type "A"
.local pmc obj
obj = new $I0
.local pmc exh
newsub exh, .Exception_Handler, _exh
set_eh exh
obj."meth"(42)
print "done\n"
end
.end
.sub _exh
print "exh\n"
print "exh - wanted '"
print S0
print "'\n"
$P0 = find_global "A", "__f42"
invoke $P0
.end
.namespace ["A"]
.sub __f42 method
print "42\n"
.end
$ parrot o.imc
exh - wanted 'meth'
42
done
leo
It needs fixing--the docs, that is, not the method. Making a custom
find_method is going to require a bit more thought, and it might well
need some other interesting stuff. (It ought not be inheritable, for
example, because then you'd need find_method to find find_method...)
--
Dan
--------------------------------------"it's like this"-------------------
Dan Sugalski even samurai
d...@sidhe.org have teddy bears and even
teddy bears get drunk
> It needs fixing--the docs, that is, not the method. Making a custom
> find_method is going to require a bit more thought, and it might well
> need some other interesting stuff. (It ought not be inheritable, for
> example, because then you'd need find_method to find find_method...)
That's fine. I don't need it now -- Allison suggested a much simpler
scheme that works with what's implemented now.
-- c