Req #53160 [Opn->Sus]: Importing and Legacy Mode suggestion for PHP 6.0 (7.0?)
Edit report at https://bugs.php.net/bug.php?id=53160&edit=1
ID: 53160
Updated by: cmb@php.net
Reported by: dmgx dot michael at gmail dot com
Summary: Importing and Legacy Mode suggestion for PHP 6.0
(7.0?)
-Status: Open
+Status: Suspended
Type: Feature/Change Request
Package: Class/Object related
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
This is certainly a feature request which requires discussion on
the internals@ mailing list, and likely the RFC process. For the
time being, I'm suspending this ticket.
Previous Comments:
------------------------------------------------------------------------
[2010-10-25 22:52:01] dmgx dot michael at gmail dot com
Description:
------------
Currently the internal PHP function library is, well, unique. Proposed is a
means to maintain backward compatibility while rectifying the problem and
hopefully on the engine side speed up the process by reducing what the zend
engine has to track.
import keyword.
import attaches the specified namespace to the current one. An error is thrown
if there is a symbol collision between the namespaces.
namespace Bar {
function Foo(){}
}
namespace Test {
import \Bar
Foo() // works
Bar\Foo() // doesn't work - try use Bar instead.
}
If import is asked to pull a namespace that doesn't exist there's an error.
Import has one other use.
namespace Test;
import @PDO;
This pulls the PDO library of PHP 6 into the Test namespace. This brings us back
to the solution of the function library problem.
PHP 6 would ship with a legacy mode set to true. In that mode everything is as
now - the namespace \ having thousands of functions.
Turn it off though and namespace \ is empty except for a core selection of
functions and objects. The rest of the function library will be divided into
libraries that can be imported as needed.
Legacy functions remain available in library legacy so
namespace MyNamespace;
import @Legacy;
would let code in MyNamespace use the current function library.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=53160&edit=1
Thread (2 messages)