in reply to Re: perspective and object-disorientation
in thread perspective and object-disorientation

Perl attempts to improve the performance of method invocations by caching the results of method lookups. These cached results become incorrect when @ISA is alterred

Oh, come on. Please get a newer version of Perl. I reported this bug in the beginning of 1997, and it was fixed shortly after. The Camel-II explicitely mentions that modifying @ISA clears the cache.

You're claiming that modifying @ISA is bad, because it changes the implementation of the class. But is that always bad? Installing a sub in an AUTOLOAD also changes the implementation of a class, and that's something done often.

I wouldn't recommend modifying @ISA, unless you're really sure what you are doing. But I also won't claim modifying @ISA should never been done.

Abigail

  • Comment on Re: perspective and object-disorientation

Replies are listed 'Best First'.
Re^2: perspective and object-disorientation
by adrianh (Chancellor) on Jan 18, 2003 at 00:35 UTC
    I wouldn't recommend modifying @ISA, unless you're really sure what you are doing. But I also won't claim modifying @ISA should never been done.

    See Test::Class & self-shunt pattern for one example where altering @ISA might be useful :-)

Re: Re: perspective and object-disorientation
by MarkM (Curate) on Jan 18, 2003 at 01:16 UTC

    Abigail: Come 'on' yourself. You must be having a crappy day to take only one thing out of my node and s$it on it. :-)

    I never claimed that modifying @ISA should never be done. Just, those who normally resort to modifying @ISA, are new to Perl, and don't really understand what they are doing.

    And even for people that do know what they are doing... it doesn't hurt to take a second look and consider whether there might not be an alternative that is more portable to other languages.

      If I wanted to write code that's more portable to other languages, OO would be one of the last things I'd consider using. Just one instance variable per object! I don't know any other language developer who considered doing that!

      Now, I wouldn't want to write code that's portable to other languages, but that's something else.

      Abigail