Re: Function/Constant autoloading

From: Date: Tue, 26 Jul 2011 08:51:45 +0000
Subject: Re: Function/Constant autoloading
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-54200@lists.php.net to get a copy of this message
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.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


« previous php.internals (#54200) next »