Aaron Crane <[EMAIL PROTECTED]> writes: > Piers Cawley writes: >> I found myself mulling over: >> >> $obj.is($other_obj); >> >> Which seems to work reasonably well, and I'd be rather surprised if it >> clashed with anything with different semantics... > > I quite like it. It also has the advantage of disallowing the equivalent > of: > > my $stored_identity = $obj.id; > # Time passes... > if ($other_obj.id == $stored_identity) { > # Massive breakage ahoy > }
Ah, sorry, I thought that went without saying. So I didn't say it. That's actually the problem that led me to come up with .is in the first place. > There just isn't any way you can get .is() to compare identities at > different times. Indeed. I'm definitely liking it the more I think about it. Someone will be along to say 'but I use C<is> in *all* my classes!' soon, mark my words.