NYCPHP Meetup

NYPHP.org

[nycphp-talk] PHP 6 features discussion

David Mintz dmintz at davidmintz.org
Sun Aug 14 13:59:49 EDT 2005


On Sat, 13 Aug 2005, Matthew Terenzio wrote:

> i used to think we needed a 'throws' keyword for methods.
> As I tried to formulate my email, I changed my mind.
>
> I'm no language architect, but it seems to me that in Java you define a
> method and let others know that it may throw a certain type of
> exception.
> That way they know in advance and MUST handle it or it won't compile.
> But  since we are not compiling, I guess all possible exceptions should
> be handled by the method or class creators, since it seems impossible
> to impart this knowledge to the class or method user.
> the class or method user shouldn't need to know anything about how the
> class works except what methods can be called, properties that are
> available etc.
> I don't know really , though


It might be nice if at least, short of forcing you to catch or throw a la
Java, you could set some sort of error reporting to alert you that you
might have had an uncaught exception from called $some->method() at line
xxx. (Yes I'm aware of set_exception_handler(), but still...).

---
David Mintz
http://davidmintz.org/



More information about the talk mailing list