Hi Stas,
On Tue, Feb 4, 2014 at 4:42 AM, Stas Malyshev <
[email protected]>wrote:
There are many code out there checks if (!extention_loaded(foo'))
die('You
need foo'). This is waste of CPU resources once it is checked. These
requirements for scripts may be evaluated at compile time and script
runs a
little faster.
Managing requirements is a job for package manager, like composer, not
language compiler, IMO.
I agree that good package manager should manage requirements. However, once
code is installed, package manager will not check requirements. (Package
manager could be made to execute requirement checks at any time, though)
Therefore, there would be developers embed environmental checks to make
sure not to die with function not found, etc.
In addition to this, there would be SCL for RHEL7 and there are some tools
like phpenv. Installing PHP does not have to be executing PHP. Even if
there is good package manager, compile time requirement check is nice to
have. It's nice to have and it's not must have, though.
Regards,
I have to agree with Stas and Sara on this one. This is not the job of the language syntax. This is the package manager's job; once the code is installed (not compiled, installed), you shouldn't be changing your version anyway without knowing what you're doing / verifying on a test system anyway.
If this were more like Javascript's "use strict", where it affected the parsing rules of that file, that would at least be useful (if potentially mind-bendingly painful for the engine; no I'm not suggesting we do that). But a shortcut for if (version_compare()) die; is not needed, and that would be a dumb way to go about implementing version requirements in the first place.
--Larry Garfield