#906: [PIR] Assignment syntactic sugar restricted to destination parameters
-------------------------+--------------------------------------------------
 Reporter:  allison      |        Owner:  kjs     
     Type:  deprecation  |       Status:  reopened
 Priority:  normal       |    Milestone:  2.6     
Component:  pirc         |      Version:  1.4.0   
 Severity:  medium       |   Resolution:          
 Keywords:               |         Lang:          
    Patch:               |     Platform:          
-------------------------+--------------------------------------------------

Comment(by plobsing):

 Replying to [comment:5 coke]:
 > This points to a some cases where we have ops defined as, e.g.:
 >
 {{{
 inline op mul(invar PMC, invar PMC, invar PMC) :base_core {
     $1 = VTABLE_multiply(interp, $2, $3, $1);
 }
 }}}
 >
 > is invar the right declaration for $1 there?

 It would be more correct to have that as inout (such errors would
 seriously throw off any attempt at register allocation for example).

 However, it still would not allow "$P0 = mul $P1, $P2" syntax, because the
 op continues to use the LHS register as an input.

 A workaround is that sugared unary and binary ops circumvent the check;
 "$P0 = $P1 * $P2" (which gets translated to "mul $P0, $P1, $P2"), "$P0 =
 5" (set $P0, 5), etc... do not trigger the assignment warning despite
 treating the LHS as an input.

-- 
Ticket URL: <https://trac.parrot.org/parrot/ticket/906#comment:7>
Parrot <https://trac.parrot.org/parrot/>
Parrot Development
_______________________________________________
parrot-tickets mailing list
[email protected]
http://lists.parrot.org/mailman/listinfo/parrot-tickets

Reply via email to