in reply to Re: a strong UNIVERSAL class
in thread a strong UNIVERSAL class

Mild correction, BTW. UNIVERSAL is the same for all class implementations; they're methods UNIVERSAL to all objects, and an object is just a blessed reference--to anything. There's also only one tie, but different TIE* methods.

theorbtwo corrects his typos from tye to tie.


Warning: Unless otherwise stated, code is untested. Do not use without understanding. Code is posted in the hopes it is useful, but without warranty. All copyrights are relinquished into the public domain unless otherwise stated. I am not an angel. I am capable of error, and err on a fairly regular basis. If I made a mistake, please let me know (such as by replying to this node).

Replies are listed 'Best First'.
Re^3: a strong UNIVERSAL class
by adrianh (Chancellor) on Nov 24, 2002 at 21:49 UTC

    Fair point :-)

    What I was trying to say (badly) was that I didn't see how tie and UNIVERSAL would fit together.

    1. Not all objects are tied objects and need to support the tie methods - so it doesn't make sense for them to be UNIVERSAL
    2. Tied scalars, arrays, etc. are different and support different methods - so having them all inherit from the same class doesn't make a lot of sense either

    I guess you could argue for a virtual class Tied, with subclasses of Tied::Scalar, Tied::Hash, etc. but it's probably not worth the effort, and would annoy the people who don't think of tie in an OO way.