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> > I'm seeking for a "more perfect" programming model for application > demanding that uncontrolled factors are limited to the max. > > Has anyone played around with PHP5 and thought about such issues?
I have been thinking about this myself. When exceptions come they will be interesting. I almost went down the path you are considering but decided that I would likely end up with an object hierarchy of the system calls available in PHP. This is something I very much did not want to deal with. I also played with creating wrapper functions that are designed to test for a specific indication of failure (returns false, returns null, etc.). The problem there is the error reporting must become more technical ("ERROR: function mysql_query returned NULL"), or more useless ("a function returned an error"). Plus, code that uses this is harder to read. 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 (memory errors are handled by PHP so it's only functions that have system calls). This has actually forced me into creating libraries for what I use and abstracting out system interfaces anyways. Also, I have started using code generation for handling the data side. 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. -- Adam Bregenzer [EMAIL PROTECTED] http://adam.bregenzer.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php