On Fri, Mar 28, 2008 at 07:41:25AM -0500, Patrick R. Michaud wrote:
> Ideally += should be implemented as the two-argument 'add' opcode
> in PIR... something like
>
> add %0, %1
>
> But the PAST compiler doesn't yet have a great way for distinguishing
> a 2-argument add from a 3-argument add. We can get close with
>
> add_p_p %0, %1
>
> but of course that means that an expression like += 2 would end up
> creating a PMC for the 2 constant. And PAST needs a way to know
> that the result is in the %0 argument as opposed to a new
> unique register (this is planned but not yet implemented).
Thinking about this further, perhaps PAST should default to
providing the 2-argument form of the 'add' opcode. This would make
implementing += and friends easier, and with the current design
of PAST there don't seem to be many places where the 3-argument
form of 'add' is more suitable than the existing 'n_add' opcode.
Then infix:<+=> would be something like
proto infix:<+=> is equiv(infix:<:=>)
is pirop('add')
is lvalue(1)
{ ... }
Pm