Marcus Boerger wrote:
In no language i know (c++, delphi, java as the popular ones) a ctor

First of all I'm a bit sad that you compare PHP with 'old' static OO languages, not 'modern' dynamic ones like Python or Ruby. Wrong focus IMHO.


Second I don't think that's a very strong point: None of the mentioned languages have the notion of a method __call either (not sure about Delphi). It's fine to copy from other languages but that doesn't mean that you cannot find better ways of doing things.

If you ask me i am pretty fine with (otherwise i wouldn't have made it so):
try {
  $db = new SQLiteDatabase($file);
}
catch (Exception $e) {

If this is the *only* place in my whole application where I use try/catch I'd rather have another way of doing it. It's much to heavy a construct for this single case.


try {
  // some control code here: start-ob, error-handler-that-throws-exceptions
  $db = new SQLiteDatabase($file);
  // your normal code **without a single error-handling-if**
}

Have you ever really used exceptions? What you're proposing is nothing better than set_error_handler on a global level. If you use exceptions all over your application though you quickly make things much more complicated, e.g. you need a DB with transactions (goodbye MySQL), otherwise you will end up with inconsistent DB states. And that's just the tip of the iceberg. Trust me, I've been there.


It not only has to be done in your PHP script but also internally at several
more places. So for me this is no option.

If you could give me back a null pointer that wouldn't be a problem.
Otherwise you need one bit per object stating if it is valid. And one line per user-visible method. I don't think that's asked too much. You're writing this code once but it will be used thousands of times.


Me too, i use both where appropriate.

Same here with the difference that I still haven't found where exceptions are appropriate yet (-:C


- Chris

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to