Re: Autoloading namespace constants and functions

From: Date: Wed, 24 Oct 2007 19:50:04 +0000
Subject: Re: Autoloading namespace constants and functions
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-32974@lists.php.net to get a copy of this message
A few different proposals have mentioned the possibility that import or use statements might trigger autoload.
I don't think it's a good idea. Import is a compile-time name transformation, it doesn't even have to be a name of any real class or namespace.
The missing piece would be allowing autoload to trigger when a fully-qualified name was used whether that name was for a function, class, or constant.
That won't be autoload that we have now, but entirely different functionality, and I'm not sure many people would really need it.
... but let do_stuff be a function in the My::Namespace namespace, not a class method of the Namespace class in the My namespace.
And how the engine is supposed to know which one do you mean?
situation, and namespaces almost get us there - I just can't make full use of namespaced functions or namespace constants right now if I want to do it.
You can't autoload functions and constants - just as you couldn't before. That doesn't prevent you from using them - just as it didn't prevent you from using them before :) -- Stanislav Malyshev, Zend Software Architect stas@zend.com http://www.zend.com/ (408)253-8829 MSN: stas@zend.com

« previous php.internals (#32974) next »