Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:35913 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 92770 invoked from network); 3 Mar 2008 12:28:00 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 3 Mar 2008 12:28:00 -0000 Authentication-Results: pb1.pair.com header.from=helly@php.net; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=helly@php.net; spf=unknown; sender-id=unknown Received-SPF: unknown (pb1.pair.com: domain php.net does not designate 85.214.94.56 as permitted sender) X-PHP-List-Original-Sender: helly@php.net X-Host-Fingerprint: 85.214.94.56 aixcept.net Linux 2.6 Received: from [85.214.94.56] ([85.214.94.56:58357] helo=h1149922.serverkompetenz.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 79/DB-29055-ECEEBC74 for ; Mon, 03 Mar 2008 07:28:00 -0500 Received: from dhcp-172-28-202-237.zrh.corp.google.com (unknown [193.142.125.1]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by h1149922.serverkompetenz.net (Postfix) with ESMTP id D906C11DB5D; Mon, 3 Mar 2008 13:27:55 +0100 (CET) Date: Mon, 3 Mar 2008 13:27:55 +0100 Reply-To: Marcus Boerger X-Priority: 3 (Normal) Message-ID: <142480450.20080303132755@marcus-boerger.de> To: =?iso-8859-15?Q?Johannes_Schl=FCter?= CC: =?iso-8859-15?Q?=22Fredrik_Holmstr=F6m=22?= , In-Reply-To: <1204544452.3463.26.camel@goldfinger.johannes.nop> References: <8697e5310802290702g49ae2bcbs9e6478832072141a@mail.gmail.com> <1204544452.3463.26.camel@goldfinger.johannes.nop> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: 8bit Subject: Re: [PHP-DEV] Re: PHP 5.3 Autoload+Namespaces+Functions incorret (atleast wierd) behaviour. From: helly@php.net (Marcus Boerger) Hello Johannes, Monday, March 3, 2008, 12:40:52 PM, you wrote: > Hi Fredrik, > On Fri, 2008-02-29 at 16:02 +0100, > "=?ISO-8859-1?Q?Fredrik_Holmstr=F6m?=" wrote: >> Basicly, the call is this: Demo::Functions::test(); where both Demo >> and Functions are namespaces, and test() is a function inside the >> Demo::Functions namespace. If you have an autoload handler here and >> the file containing the Demo::Function::test()-decleration isn't >> loaded, autoload will be called. >> >> Now everything seems fine, but the problem is that when the autoload >> hooks have all fired php looks for the class Demo::Function, because >> autoload seems to be interpreting the Demo::Function::test(); call as: >> ::::, when it should be >> ::::, and since the Function class >> doesn't exist it will trigger a fatal error. > autoload was designed for loading classes not functions. Wen resolving > Demo::Function::test() and no function having that name is being found > it's assumed that Demo is the namespace, function a class name in there > and test a static method call. There's no way for the engine to see what > else might be meant. So the result is expected and changing it woud mean > to do major changes wich just creates new problems. Actually we can (I think). There are to possibilities: new namespace::class() new namaespace::namedspace::class() and so on, or: namespace::class::functoin() namespace::function() and so on. That is, when detecting braces after it and a new in front than it is a class. If there is no new in front it must be a function and autoload needs to be called for all but the last part. With new it needs to be called for all parts. Since the compiler already knows whether it generates a ctor call we must have an issue that should be fixable. Best regards, Marcus