Re: Function/Constant autoloading
| From: | Nathaniel Catchpole | Date: | Tue, 26 Jul 2011 08:35:35 +0000 |
| Subject: | Re: Function/Constant autoloading | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-54198@lists.php.net to get a copy of this message | ||
There is lazy loading for functions via apc.lazy_functions (although I've
not properly tested this yet). That doesn't require any userspace code
changes.
For define() I'm not aware of anything allowing for lazy loading constants
(define() is just a function call).
However there are a few approaches for avoiding define(), you could look at
apc_define_constants(), http://pecl.php.net/package/hidef and
http://pecl.php.net/package/chdb, you could also
switch to class constants
and lazy load your classes.
I haven't
On Tue, Jul 26, 2011 at 5:18 PM, Sebastian Krebs <
sebastian.krebs.berlin@googlemail.com> wrote:
> Hi,
>
> Maybe this topic occured already, then sorry when I'm wasting your time,
> but I'm wondering, why there is no autoloading for functions and
> (namespace)constants.
>
> When a class is not found, then an userland function is called. Thus I
> don't see a reason, why something like this doesn't exists for functions and
> (namespace)constants too, because using them is quite uncomfortable right
> now compared to classes and the decision _how_ to load them would be on the
> developers-side anyway.
>
> Sebastian Krebs
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>