Dan Sugalski wrote: > This: > > new P0, .PerlScalar > new P1, .PerlArray > assign P0, P1 > > isn't code that a compiler should be emitting. (snip alternative compiler output) > Though I freely admit that's a big punt on the real problem, which we > still need to address. > > I'm up for suggestions, since sooner or later someone's going to emit > code like that, and its nice to know what its supposed to do...
How about something along the following lines: <perlarray.pmc> void get_preferred_type(INTVAL context) { switch (context) { case CONTEXT_SCALAR: return BASETYPE_INTVAL; } } <perlscalar.pmc> void set_pmc(PMC* value) { switch (value->get_preferred_type(INTERP, value, CONTEXT_SCALAR)) { case BASETYPE_INTVAL: set_integer(INTERP, SELF, value); break; } } -- Peter Gibbs EmKel Systems