Proposal: addition of import namespace into current ns to Autoloader

3 views
Skip to first unread message

Jelmer Schreuder

unread,
May 21, 2011, 2:08:53 PM5/21/11
to fuelph...@googlegroups.com
Let's fix a PHP namespace issue: we can't import classes into current namespace.

What if we allowed our own import statement: Autoload::import('namespace_from', 'namespace_to');
We should be able to detect the current file through debug_backtrace() and after that the autoloader knows to alias requests to the location from which it was requested to the imported one. We probably shouldn't use this by default but it would be a nice language-fixing feature.

I know this brings back some of the crazy aliassing we had earlier, but I think that when implemented like this (= not used by default) it might be a very helpfull addition for those missing this feature in PHP. This should also make any transition to more namespaces for Fuel 2.0 less painfull.
Reply all
Reply to author
Forward
0 new messages