Adam Bregenzer wrote:
On Mon, 2004-02-09 at 15:58, Markus Fischer wrote:
But doing this now for every internal function call I don't want to lead my program into an unwanted state isn't very appealing.
<snip>
Ultimately I decided to wrap my necessary function calls in error checking wherever they are in my files. This gives me more granularity in the application of the error at the cost of some code bloat. It's not an optimal solution but I have found I use little functions calls in the first place that would generate an exception in return.
Isn't this the same thing I started doing anyway? I however didn't integrated those functions in my application directly but put them in a file of its own so I can (hopefully ;) reuse them.
Also, I have started using code generation for handling the data side.
This sounds very interesting. Can you elaborate how and what you actually did for generating the code (what was your input and how did you transform it)?
Ultimately I think it would be nice to have an object hierarchy of the function calls in php. However I don't see php supporting it natively and PEAR is still trying to sort itself out. Being a 'third party' project it is too much for one person but would be quite useful. Maybe when php5 becomes more popular we can all band together and standardize this.
I think such a real hierarchy of classes will never exist. That's too much for PHP; none of the developers want to break BC and also follow the KISS credo (which is good, imho).
But it sounds interesting in re-creating the globbered global function table of PHP in a well thought class framework and make it exception-proof. But that would be a step back either if this wrapping would only occur in PHP side -> for every PHP function there would need to be called a userland PHP code before. I even don't want to think about the performance implications. But well, since this is effectively what I started with with my "System" class, there my be needs where this trade off is accecptable (compensating longer execution time with caches and more hardware power/ram/whatever).
I think for the current issue I will just continue recreating the PHP functions inside an exception-proof class if I don't find a better way. Only creating them on-demand isn't a real problem (at the moment).
- Markus
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php