4 ms·
The Perl way is to declare minimum language version to execute a code file. E.g. use v5.12; Then you can do extensions [even changing central functionality] in
by BugBrother 13y ago
The Perl way is to declare minimum language version to execute a code file. E.g. use v5.12;
Then you can do extensions [even changing central functionality] in a sane way, with backward compatibility. (A language implementation need to implement deprecated features for older versions, of course.)
I agree with your point re APIs.
- wvenable 13y agoI've had this idea of minimum language version as well. In PHP it should probably done at the namespace level. It doesn't even need new language syntax, just a function to declare the minimum PHP version for a namespace and child namespaces: set_minimum_version('My/New/Component', '5.7.8'); This could be called in the component itself or maybe by a composer autoloader. Then PHP components that expect different version could live together. The big problem, as you mentioned, is that the interpreter would have to maintain all the deprecated features and behavior for older versions and that would make development and maintenance of PHP much more complicated.
- oafitupa 13y agoThat's what we do with Composer, we set the minimum PHP version.
- krapp 13y agoI've done and seen it done in wordpress plugins, sometimes.