|
|
|
|
|
by randallsquared
5506 days ago
|
|
Don't you think it's a ridiculous notion that the distinctions between include and require (and the once variants) are meaningful enough that programmers should be able to express them? Not at all. They mean different things, and they're used for different things. Import-if-it's-available is include, import-or-error-if-missing is require, and they're both quite handy. The once variants do what most programmers would expect, but the non-once ones do what most template users would expect. Should the "once" have been a flag? Yeah, why not? But that doesn't mean the functionality shouldn't even exist. |
|
When the problem is framed thus, most people would recognize that the solution to that problem is a better understanding on the part of the programmer of the flow of control inside his/her application.
The error handing should be done with exceptions. As it is, there are many errors in PHP which are recoverable, but they don't throw exceptions but instead emit other kinds of non-catchable failures. In Python, you would simply `try` to import a module and `catch` a failure to do so, e.g. if that module wasn't installed.