NYCPHP Meetup

NYPHP.org

[nycphp-talk] 2 more php5 questions ...

jon baer jonbaer at jonbaer.net
Mon Feb 16 06:34:47 EST 2004


ok, not looking to get heckled just looking for explainations :-)

1. first, im really into the fact that you now can declare the type of
objects passed into function *but* why only custom classes?  i know the
beauty of loose type is nice but when reading code it would be nice to see
what i should be expecting + drop the redundancy to need to check variables
over + over:

function foo(String $bar)
function foo(Integer $bar)

i personally dont care if it doesn't do a type check (well would be weird if
it didnt) but would help make the code more readable.

2. will there be a complete generic exception handler built-in or is there
one - did i miss it?  for example this type of simple bad connection error:

try {
    mysql_connect("blah","blah","blah");
} catch (Exception $e) {
    echo $e->getMessage();
}

is the TCF stuff mainly for new classes being built?  would it not be
helpful to have something like this built-in for older stuff (PHP4/5) or
something in the php.ini:

error_reporting(E_USER_ERROR);
set_error_handler("err");
function err($errno, $errstr, $errfile, $errline) {
  throw new Exception($errno . $errstr);
 }

like i said i probably missed something ...

- jon

pgp key: http://www.jonbaer.net/jonbaer.asc
fingerprint: F438 A47E C45E 8B27 F68C 1F9B 41DB DB8B 9A0C AF47




More information about the talk mailing list