in reply to Re^2: RFC: Perl meta programming
in thread RFC: Perl meta programming
ref gives you a class name. It's easy to fool; bless something into the wrong class name (or worse, a class name such as SCALAR. It's also easy to get wrong -- why do you have to know if something is a hash reference explicitly if the important thing is that you can dereference it as a hash (as in, it's a tied hash or has hash overloading)?
ref ties you to a very specific representation of data, and it's extremely fragile. Fragile code breaks easily. It's a bad thing.
With Scalar::Util's reftype() for the times when I really need to break encapsulation, I can't think of a good reason to keep ref in the language itself.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: RFC: Perl meta programming
by jdporter (Paladin) on Oct 20, 2006 at 12:24 UTC |