From: "Patrick R. Michaud" <[EMAIL PROTECTED]> Date: Mon, 27 Oct 2008 13:32:02 -0500
On Sun, Oct 26, 2008 at 09:37:36PM -0400, Bob Rogers wrote: > .sub 'main' :main > foo('Hello') > .end > .sub foo :multi(String) > .param pmc s > > say s > .end > [...] > Which brings us to an interesting question: How can you decide what > type to use for autoboxing before you've determined the actual sub > you're going to call? And how can you find the sub without having the > correct dispatch types up front? According to t/pmc/multidispatch.t, :multi can specify 'string', 'int', and 'num' to match the native (non-PMC) types . . . Returning to chromatic's original post, "no applicable methods" is actually what I would expect from the code given, since there are no methods defined taking the 'string' or 'int' type as the first argument. All true. But it's unfortunate that the Parrot type system considers "int" and "Integer" unrelated. As a result, MMD prevents autoboxing (when chromatic and I had expected otherwise). Which brings up another interesting (to me) question: Does anyone know of an HLL in which the type system makes a formal distinction between boxed vs. unboxed values? I am acquainted with only a few languages that support boxing/unboxing, and all consider an int an int, boxed or not. -- Bob