Hello,
there's something that's been on my mind for a while, but I've not yet
fully managed to think more about feasibility.
For those who didn't know this already, Python has a pseudo-module
future that allows BC breaks in future versions to be anticipated.
I'll quote an example:
===================================================
Under 2.0, it prints:
x is 42
Nested scopes[2] are being introduced in 2.1.
But under 2.1, it still prints
x is 42
and also generates a warning.
In 2.2, and also in 2.1 *if*
"from __future__ import nested_scopes" is
included at the top of scope.py, it prints
x is 666
===================================================
The whole process is detailed in PEP-236 [1].
So, I do know we're in dealing with BC differently than python does and
even the import methodology may make slightly less sense with namespaces...
...but did everyone ever put some thought into this?
- As this is done at compile-time, wouldn't it be a
glorified auto-prepend on steroids? - Would it imply backporting much stuff? probably not possible,
like for example "traits in 5.3" - Would it be worth some effort in PHP itself so that people could
code forward-compatible in 5.x to anticipate BC breaks in 5.x+1? - Does it make sense at all? :)
Just some food for thought.
Greetings,
Florian
Am 24.06.2011 14:00, schrieb Florian Anderiasch:
- Would it be worth some effort in PHP itself so that people could
code forward-compatible in 5.x to anticipate BC breaks in 5.x+1?
Along the same lines, but not WRT BC, is http://pear.php.net/PHP_Compat
which backports features by implementing them in PHP.
--
Sebastian Bergmann Co-Founder and Principal Consultant
http://sebastian-bergmann.de/ http://thePHP.cc/