in reply to chaining method calls
The only real problem I have with it is that error checking (or debugging) can be a pain, as you noted. (update: That is, doing "nice" error checking doesn't allow this while debugging with it is confusing.)
But the solution to that is to have these methods, on failure, return an "error object" that uses AUTOLOAD to return itself no matter what method gets called on it, in a string context gives back the descriptive error that it was created with (which should include method names and line numbers and such), in a boolean context returns a false value, and, if it gets destroyed without having been used in a boolean or string context, it dies with the descriptive error.
I been wanting to write that "error object" for a few years now. (: Just haven't found the time/motivation/prioritization. ):
- tye
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re: chaining method calls (smart error object)
by Ovid (Cardinal) on Jun 11, 2003 at 23:42 UTC | |
Re: Re: chaining method calls (smart error object)
by submersible_toaster (Chaplain) on Jun 12, 2003 at 06:56 UTC | |
by adrianh (Chancellor) on Jun 12, 2003 at 10:09 UTC |