in reply to Unlimited chaining (is there a way to detect this?)

In other words, you've set up a situation where $o->bar returns $o2 and blessed($o) eq $blessed($o2). So, it's mathematically provable that it literally doesn't matter* how many calls to bar() you make before the call to baz(). Furthermore, you haven't made a case as to why the author of Foo and BaseClass even cares whether or not baz() is called once or 1.233212e1234 times. So, don't worry about it until you have a reason to worry about it.

*: Well, it does matter depending on how well the VM detects that the intermediate objects can be thrown away immediately. Otherwise, you can theoretically get into a situation where you run out of RAM after enough chained calls. But, that number of chained calls would be so ridiculously high that you're just as likely to get into a problem with running out of RAM during parsing or just storing the file on disk. (Have you ever tried running a 500M .pm file?)


My criteria for good software:
  1. Does it work?
  2. Can someone else come in, make a change, and be reasonably certain no bugs were introduced?
  • Comment on Re: Unlimited chaining (is there a way to detect this?)