Re: Class names (with regard to autoload)

From: Date: Thu, 26 Feb 2009 22:04:40 +0000
Subject: Re: Class names (with regard to autoload)
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-43195@lists.php.net to get a copy of this message
I think what you're doing is effectively the same as doing: $fb = new Part .''. SubPart(); So basically concatenating a new instance of Part, with the results from the function SubPart. Try defining Part as a class and see what error you get. If I'm right, you'll get an undefined function error. 2009/2/26 Robin Burchell <viroteck@viroteck.net>: > On Thu, Feb 26, 2009 at 8:48 PM, Guilherme Blanco > <guilhermeblanco@gmail.com> wrote: >> I doubt you'll find a patch to it. >> >> Mainly, the patch will be against this principle: >> > <snip> > > Hmm, that wouldn't actually have an impact, as (at least, what I'm > aiming for/wanting to do) is not to introduce periods as valid in > actual class names, but to allow them to be used for autoloading - so > I can have something like this (abbreviated terribly, apologies): > > function __autoload($sFoo) > { >    include(str_replace(".", "/", $sFoo)); > } > > .. so, your example would expand to Foo.Bar, which given that periods > aren't allowed in a class name doesn't exist as a class, and won't > work. Unless I'm missing something? > > > > Actually, I don't believe that expanding is even done - i.e. it > doesn't respect defines there > > Seems that way on testing, too: > > class FooBar > { >        // ... > } > > define('Part',  'Foo'); > define('SubPart',  'Bar'); > > $fb = new Part.SubPart(); > > > gives: Fatal error: Class 'Part' not found > > .. but that part of things is a going off on a bit of a tangent. > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > >

« previous php.internals (#43195) next »