Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:39022 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 62736 invoked from network); 16 Jul 2008 20:16:21 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 16 Jul 2008 20:16:21 -0000 Authentication-Results: pb1.pair.com header.from=mls@pooteeweet.org; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=mls@pooteeweet.org; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain pooteeweet.org from 88.198.8.16 cause and error) X-PHP-List-Original-Sender: mls@pooteeweet.org X-Host-Fingerprint: 88.198.8.16 bigtime.backendmedia.com Linux 2.6 Received: from [88.198.8.16] ([88.198.8.16:49578] helo=bigtime.backendmedia.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 1A/76-54589-5175E784 for ; Wed, 16 Jul 2008 16:16:21 -0400 Received: from localhost (unknown [127.0.0.1]) by bigtime.backendmedia.com (Postfix) with ESMTP id 5D2444144007; Wed, 16 Jul 2008 20:16:49 +0000 (UTC) X-Virus-Scanned: amavisd-new at backendmedia.com Received: from bigtime.backendmedia.com ([127.0.0.1]) by localhost (bigtime.backendmedia.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id lOmdTti4io1H; Wed, 16 Jul 2008 22:16:48 +0200 (CEST) Received: from [192.168.0.151] (77-57-23-243.dclient.hispeed.ch [77.57.23.243]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: mls@pooteeweet.org) by bigtime.backendmedia.com (Postfix) with ESMTP id 6CBDA4144006; Wed, 16 Jul 2008 22:16:46 +0200 (CEST) Cc: Stanislav Malyshev , PHP Developers Mailing List , Dmitry Stogov Message-ID: To: Greg Beaver In-Reply-To: <4877CE04.4070104@chiaraquartet.net> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v928.1) Date: Wed, 16 Jul 2008 22:14:55 +0200 References: <486FA5FB.1000300@php.net> <4872B5D4.1000205@zend.com> <4877CE04.4070104@chiaraquartet.net> X-Mailer: Apple Mail (2.928.1) Subject: Re: [PHP-DEV] Re: towards a 5.3 release From: mls@pooteeweet.org (Lukas Kahwe Smith) On 11.07.2008, at 23:17, Greg Beaver wrote: > Stanislav Malyshev wrote: >> Hi! >> >>> This fixes the logic problem, and re-introduces the performance >>> slowdown for internal classes. FORTUNATELY there is a simple >>> solution to this, which is to "use" all global classes: >> >> The thing is since it'd work without "use", most users would do it >> that way and have horrible code. But if you can do use ::Exception, >> you can the same way do use Foo::Exception, right? So what's the >> difference? > > The difference is in what you quoted - name resolution is non- > deterministic with current implementation. The suggested change > always works the same way. It turns out my internet access is even > worse than I thought, so I may only be reading/replying once every > week to two weeks until August, please bear with me :/ > > In other words, with the current implementation, you can just do > "use Foo::Exception;" and it works, but if you *forget* to do the > use statement, you can get unpredictable behavior with no warning > until your code starts not working properly. With the suggested > change of name resolution, your code always works as you designed > it, but if you forget to "use ::Exception", then your code is simply > slightly slower (1 extra call to autoload if it exists), but still > works properly. It also tilts the "use" towards internal > classnames, which in my experience tend to be outnumbered by > userspace classnames, so it will reduce code size, making it more > readable. Greg's argument seems sound to me. With the proposed change errors are less likely and more transparent in case they happen (for people using autoload that is). At the same time people who care about performance can still work around this behavior (then again those that care about optimizations on this level probably do not use autload to begin with). So I guess the point is .. autoload is there for convinience, so lets make it as convinient as possible. regards Lukas Kahwe Smith mls@pooteeweet.org