Re: auxiliary variables

2004-12-20 Thread Dan Sugalski
At 12:00 AM +0100 12/20/04, [EMAIL PROTECTED] wrote:
Please
Lets have two scalars variables in Perl and some operation under
them like an adding.
x = a + b
I would like know, witch auxiliary variables are creating
on the in-line code like a Parrot
somethink like T = a + b
   x = T ???
For simple expressions there's no need for temps. "x = a + b" 
translates to "add x, a, b". If you have more complex expressions and 
need temps, then generally the compiler will choose the correct temp 
type, since it's normally language dependent. (Though Parrot's Undef 
is generally clever enough to be a good generic destination, as it 
morphs to most destination types on assign)
--
Dan

--it's like this---
Dan Sugalski  even samurai
[EMAIL PROTECTED] have teddy bears and even
  teddy bears get drunk


Re: auxiliary variables

2004-12-19 Thread Luke Palmer
[EMAIL PROTECTED] writes:
> Please
> Lets have two scalars variables in Perl and some operation under 
> them like an adding. 
> x = a + b
> I would like know, witch auxiliary variables are creating 
> on the in-line code like a Parrot 
> 
> somethink like T = a + b
>  x = T ???
> 
> and on witch circumstances depends it. 
> Can I keep clear of creating this auxiliary variables anywise ?

We have no idea when they'll come up, because we haven't even layed out
the groundwork for the code generator yet.

However, such auxilliary variables show up in a lot of places.  For
instance, when you add two PMCs, you need an Undef in which to put the
result.  I don't entirely agree with this semantic: I think the result
PMC should be created by the add function itself.

This is how it works now:

$P0 = new PerlInt
$P0 = 3
$P1 = new PerlInt
$P1 = 4
$P2 = new Undef
$P2 = $P0 + $P1

If that counts as an auxilliary variable, you'll see them all over the
place.  And there's not really a way you can avoid it.

In fact, I don't think you could avoid it if you wrote in bare PIR
without going through a compiler.

Luke


auxiliary variables

2004-12-19 Thread tomas . necas
Please
Lets have two scalars variables in Perl and some operation under 
them like an adding. 
x = a + b
I would like know, witch auxiliary variables are creating 
on the in-line code like a Parrot 

somethink like T = a + b
   x = T ???

and on witch circumstances depends it. 
Can I keep clear of creating this auxiliary variables anywise ?
 
Thanks a lot Tomas



-- 
A za kolik kupujete ELEKTRO Vy?
http://www.MALL.cz/penezenka
Ověřte si přes SMS, kolik se dá UŠETŘIT!