On Thu, Aug 28, 2014 at 10:33:15AM -0700, Karen Etheridge wrote:
> On Thu, Aug 28, 2014 at 12:43:48PM +0100, David Cantrell wrote:
> > On Wed, Aug 27, 2014 at 08:54:07AM -0700, Karen Etheridge wrote:
> > > ..but as others have said, you don't 'use UNIVERSAL' directly - in fact 
> > > the
> > > word 'UNIVERSAL' should never have to appear in your code.
> > It might never *have to* appear in your code, but it is on occasion
> > rather handy. UNIVERSAL::isa is useful for non-objecty code that
> > manipulates or inspects classes, for example.
> You should never run UNIVERSAL::isa as a function - only run it as a
> method, using the class or object as the invocation subject.

That wasn't true when chromatic was banging on about this a few years
back, and it's not true now.

> Calling it this way breaks any code that overrides isa().

You should never override isa().

Look, I can make assertions too!

Overriding isa() is lying, which is naughty.

Look, I can justify my assertions too!

And it's the very fact that SomeClass->isa() might tell lies that means
that UNIVERSAL::isa() is sometimes the right thing to do.

-- 
David Cantrell | Minister for Arbitrary Justice

      You know you're getting old when you fancy the
      teenager's parent and ignore the teenager
        -- Paul M in uknot

Reply via email to