In [1], Larry writes: > [...] we left = in the language > to provide (to the extent possible) the same semantics that it > does in Perl 5. And when it comes to non-value types, there really > are still references, even if we try not to talk about them much. > So I think assignment is basically about copying around identities, > where value types treat identity differently than object types (or > at least, objects types that aren't pretending to be value types).
So, how does one get an object to pretend to be a value type for purposes of assignment? Currently if I do the following class Dog { ... } my $a = Dog.new; my $b = $a; then $a and $b both refer to the same Dog object. How would I define Dog such that it acts like a value type -- i.e., so that $b would be a copy of $a and future changes to the object in $a don't affect $b. (Various parts of the synopses talk about .WHICH being used to define value types, but I don't quite see how that fits in to assignment.) Thanks! Pm