On Thu, Nov 30, 2000 at 12:46:26PM -0500, Dan Sugalski wrote:
> (Moved over to -internals, since it's not really a parser API thing)
> 
> At 11:06 AM 11/30/00 -0600, Jarkko Hietaniemi wrote:
> >Presumably.  But why are you then still talking about "the IV slot in
> >a scalar"...?  I'm slow today.  Show me how
> >
> >         $a = 1.2; $b = 3; $c = $a + $b;
> >
> >is going to work, what kind of opcodes do you see being used?
> >(for the purposes of this exercise, you may not assume the optimizer
> >  doing $c = (1.2+3) behind the curtains :-)

$a=1; $b =3; $c = $a + $b

 
> If they don't exist already, then something like:
> 
>          newscalar       a, num, 1.2
>          newscalar       b, int, 3
>          newscalar       c, num, 0
>          add             t3, a, b

and $c ends up a num?
why that line "newscalar c, num, 0" ?
It looks to me like add needs to be polymorphic and work out the best
compromise for the type of scalar to create based on the integer/num/
complex/oddball types of its two operands.

[Oh. but I'm blinkered in this because I'm attempting to make pp_add in
perl5 do this sort of thing, so I may be missing a better way of doing it]

> But that probably doesn't help much. Let me throw together something more 
> detailed and we'll see where we go from there.

Hopefully it will cover the above case too.

Nicholas Clark

Reply via email to