On Thu, Oct 17, 2013 at 8:16 PM, J David <[email protected]> wrote:
> On Thu, Oct 17, 2013 at 1:52 PM, Andrea Faulds <[email protected]> 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…"
>
Well, I'd ask myself *why* they all jumped. Since they are not dumb,
there's likely a good reason for it. Maybe it's a wooden bridge and it's on
fire? In that case, sure, I'd jump right after them ;)
> 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?
>
Yes, require() should throw an exception from a modern point of view. It
doesn't, because it was introduced at a time where we had no exceptions.
Parse errors should theoretically also be exceptions, but with the current
compiler this is simply technically infeasible. Actually "technical
infeasibility" is the only sane reason I can think of to throw a fatal
error.
Anyway, I won't continue this pointless discussion, doesn't seem like we're
getting anywhere with it.
Nikita