in reply to -isa() and -can() asymmetry

k According to Damian Conway, it's so that run-time changes to the inheritance hierarchy will be reflected in the result can returns. This makes sense. but why would you know want those same changes reflected in the result that isa returns?

It's not an issue of the utility, but a question of why one would need it and the other would not.

Replies are listed 'Best First'.
Re: Re: -isa() and -can() asymmetry
by demerphq (Chancellor) on Sep 02, 2001 at 17:33 UTC
    why one would need it and the other would not
    Well, I dont know why for sure, but maybe its do with what Perl users do more often.

    I cant think that i've every dynamically written to ISA (reading it is a different story if you are doing multiple inheiretance.)

    Whereas I have on MANY occasions dynamically added new subs to an existant class.

    Just think of any code that gets autoloaded. If can cached then a lot of things would get confused wouldnt they? Or there would have to be a cache flush any time something gets added to the package level symbol table. Not very efficient.

    Well thats my theory anyway.

    Yves

Re: Re: -isa() and -can() asymmetry
by virtualsue (Vicar) on Sep 02, 2001 at 17:34 UTC
    It's not an issue of the utility, but a question of why one would need it and the other would not.

    I dunno, but from what I've read it sounds like isa() was built for speed, while can() was built to work no matter what sort of underhanded trickery you might have performed on @ISA. With any luck someone better versed in OO Perl will step in now and give us a deeper explanation of the topic.

      My guess is that both were built for speed, but can could work off of the same method lookup cache that Perl uses for regular method lookups, so accuracy came for free.

      Now why didn't they just bite the bullet and make isa accurate as well? I don't know, because if I was going to offer the feature I would make accuracy a priority. :-(