Jeff Horwitz wrote:
for mod_parrot i want to support both passing both PMCs and native types
to the apache API, depending on the HLL. MMD was doing a great
job handling this for me until i ran into a problem.
given the following methods:
.sub bar method, @MULTI(Foo, string)
.sub bar method, @MULTI(Foo, pmc)
.sub bar method, @MULTI(Foo)
and assuming 'Foo' is an object PMC, here's what happens when i call
'bar' with various arguments:
$I0 = find_type 'Foo'
$P0 = new $I0
$P0.'bar'() # calls the empty arg version of bar
$P0.'bar'("a string") # calls the string version of bar
$P1 = new PerlString
$P1 = "a perl string"
$P0.'bar'($P1) # XXX calls the empty arg version of bar
the pmc version of bar() is never called, even when passing a PMC. if i
change the prototype to @MULTI(Foo, PerlString), i can pass the PerlString
to that, but i'd prefer to be able to pass any arbitrary PMC without
explicitly specifying its type in the method.
Multi subs and especially multi methods are barely tested. 'pmc' or '_'
should match 'Any' PMC, so that's for sure a bug. Can you please provide
a test-like sample file to investigate, thanks.
-jeff
leo