Hi,

Thanks for your reply

Am 26.07.2011 10:35, schrieb Nathaniel Catchpole:
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.

As far as I can see this is for built-in functions only. The problem I see is, that APC cannot know, where my functions are located and therefore cannot load it without userspace help.


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.

Maybe my description were a little bit misleading: I was talking about especially namespace constant like


namespace my\ns;
const FOO = 'BAR';


I know I can use class constants instead (as well as I can use static methods instead of functions), but that makes me feel, that functions and namespace constants are more or less useless now.


I haven't



On Tue, Jul 26, 2011 at 5:18 PM, Sebastian Krebs<
sebastian.krebs.ber...@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




--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to