Re: Assertions
| From: | J David | Date: | Thu, 17 Oct 2013 18:16:18 +0000 |
| Subject: | Re: Assertions | ||
| References: | 1 2 3 4 5 6 7 8 9 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-69652@lists.php.net to get a copy of this message | ||
On Thu, Oct 17, 2013 at 1:52 PM, Andrea Faulds <ajf@ajf.me> wrote:
> In addition to all that you've said, I should point out that both Java and
> Python have an assert statement which raises an exception, which happens to
> be called AssertionError in both languages.
And in Python you can subclass an int. This does not make that a good
idea for PHP. (Java only wishes it could subclass int, hence
Integer.)
In Java, for better or for worse, every error is an exception. This
does not make that a good idea for PHP.
(Shrill voice) "If all your friends jumped off a bridge…"
Should require($myFile) throw an exception too? (Some people, perhaps
many, would say yes.) What about parse errors in a file include()d at
runtime?
Thanks!