On Fri, Mar 14, 2003 at 01:20:28PM +1100, Damian Conway wrote:
: Luke Palmer wrote:
: 
: >So, now that we have binding, is it possible to overload the
: >assignment operator?  
: 
: Not really. The problem is that C<&infix:=> is really an operator on 
: *containers*, not on *values*. So, in order to overload C<=>, you'll still 
: need to define an appropriate C<STORE> method on the appropriate 
: implementation class for the container. Whether C<STORE> can also be 
: spelled C<&infix:=> is another question.
: 
: 
: >Does the assignment operator mean "value copy"
: >instead of "reference copy"?
: 
: The assignment operator means copy rhs's value into lhs's container.
: The binding operator means copy (reference to) rhs's container into lhs's 
: symbol table entry.

Note that assignment is a very shallow copy in any event.  Intrinsic types
are copied by default, plus any objects with a .copy method.  In other words,
Scalar has a .copy method by default, and anything else is your own doing.
Int, Num, Str, and Ref inherit the .copy interface from Scalar.  In particular,
a Ref only copies itself unless it refers to something with a .copy method.

In other words, the .copy method defines it as an intrinsic scalar type.

That's exactly how it works, bearing in mind that any or all of the
details might be wrong.

Larry

Reply via email to