# from __future__ import...

- Thread: https://externals.io/message/53573
- Original archive: https://news-web.php.net/php.internals/53573
- Started by Florian Anderiasch on 2011-06-24T12:00:03+00:00
- Messages: 2
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #53573 — Florian Anderiasch — 2011-06-24T12:00:03+00:00

URL: https://externals.io/message/53573#53573

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


[1] http://www.python.org/dev/peps/pep-0236/

---

## #53582 — Sebastian Bergmann — 2011-06-25T09:11:40+00:00

URL: https://externals.io/message/53573#53582 · In reply to: #53573

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/
