Re: Function/Constant autoloading
| From: | Ferenc Kovacs | Date: | Tue, 26 Jul 2011 08:53:34 +0000 |
| Subject: | Re: Function/Constant autoloading | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-54201@lists.php.net to get a copy of this message | ||
On Tue, Jul 26, 2011 at 10:39 AM, Sebastian Krebs
<sebastian.krebs.berlin@googlemail.com> wrote:
> Hi,
>
> thanks for your reply, but I'm not talking about class loading (because
> thats already possible). I'm talking about autoloading of userspace
> functions and constants
>
>
> // /path/to/my/functions.php
> namespace my\functions;
>
> const THING = 'I am constant!';
>
> function helloWorld () {
> echo "hello World;
> }
>
> // /path/to/some/other/file.php
> namespace foo;
> use my\functions;
>
> functions\helloWorld(); // fail!
> echo functions\THING;
>
>
I think it's pretty clear what are you after.
autofunc with a patch:
http://www.mail-archive.com/internals@lists.php.net/msg43983.html
__autodefine proposal and rfc:
http://www.mail-archive.com/internals@lists.php.net/msg48986.html
https://wiki.php.net/rfc/autodefine?s[]=autodefine
from the replies I think that the idea didn't got traction from the core devs.
--
Ferenc Kovács
@Tyr43l - http://tyrael.hu