On Wed, Nov 10, 1999 at 09:30:51PM -0500, John Macdonald wrote: > || Without being able to overload assignment, you can build an > || object that drives completely like a scalar with one subtle > || yet frequently encountered exception: assignment is shallow. > > But what is the meaning of overloaded assignment? In > particular, how do you distinguish between assigning a > new value to an object of a particular type from assigning > a typed value to a variable (thereby changing the type of > the variable)? When you write: > > my $x = 1; # $x has an integer value > $x = 'abc'; # now it has a string value > > you don't expect the second assignment to be affected by the > previous contents of $x. The old contents are simply replaced > with the new contents *and its type*. > Overloading assignment only makes sense in a strongly typed > language. Which Perl became now (at least enough to make overloading assignment easy). See `PREPARE' thread. IlyaThread Previous