in reply to Re: Re: eq or == with references
in thread eq or == with references
Yes, using == on references does not "reference arithmatic" make... (sierrathedog04 wrote
The Perl compiler ought to prohibit numeric operations on references.). Perl doesn't support any numeric operations on references. It does support converting a reference to a number and then doing numeric operations on those. It certainly doesn't support converting a number (no matter how you got it) into a reference (nor does it support any operations that take a reference and a number as input and return a reference as output). So I don't understand the leap from == to fears of reference arithmatic.
I don't like using eq to compare references because it feels very much like comparing numbers via: sprintf("0x%X",$num1) eq sprintf("0x%X",$num2) (And if a design bug I found in overloading is ever fixed, I'm likely to overload the stringification of many of my objects but would never overload the numeric value of them so, if that were to happen, eq would become unreliable while == would continue to work. I think it makes sense to have objects return human-readable stringifications but don't see much use for numeric values of objects except as already provided for.)
Anyway, I wanted to point out that in (tye)Re: Creative use of pack/unpack I heavily abuse the numeric value of references in a way that I think only the insane would take seriously. In (tye)Re2: resurrecting objects? I hint that even more insanity is technically possible, though not even I have been insane enough to actually try that. ;)
- tye (but my friends call me "Tye")
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: (tye)Re3: eq or == with references
by sierrathedog04 (Hermit) on Jul 09, 2001 at 15:30 UTC | |
by tye (Sage) on Jul 09, 2001 at 19:51 UTC | |
by sierrathedog04 (Hermit) on Jul 09, 2001 at 22:30 UTC |