in reply to Re: RFC: Perl meta programming
in thread RFC: Perl meta programming

Please expand on this observation or point to some resources that can shed some light on your reasoning?


TGI says moo

Replies are listed 'Best First'.
Re^3: RFC: Perl meta programming
by chromatic (Archbishop) on Oct 20, 2006 at 09:22 UTC

    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.

      Some related discussion in this FWP thread.

      We're building the house of the future together.