Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:56264 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 99364 invoked from network); 10 Nov 2011 23:29:31 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 10 Nov 2011 23:29:31 -0000 Authentication-Results: pb1.pair.com smtp.mail=ircmaxell@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=ircmaxell@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.220.170 as permitted sender) X-PHP-List-Original-Sender: ircmaxell@gmail.com X-Host-Fingerprint: 209.85.220.170 mail-vx0-f170.google.com Received: from [209.85.220.170] ([209.85.220.170:54384] helo=mail-vx0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 27/33-17932-A5E5CBE4 for ; Thu, 10 Nov 2011 18:29:30 -0500 Received: by vcbfl10 with SMTP id fl10so3288428vcb.29 for ; Thu, 10 Nov 2011 15:29:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=eUe8+upm7Xd4+EzvMQHGgysHgKVx6fCJzbW6fFwqa9Q=; b=lHATYnXaBP3mQfztKwob2hfB5lea/AF9J9iZyfuxGJA9fKEe2GYAl1ParLsJAyUrPY Dpo1Ey0ijhd6VL3qhq3kAEqpnQ23yYHVwOKKk5o4CfAbmfiHF0On6df9nAu7sq7xftoS 2R1IDG/1Tdov/8TrnuHNtoGPLA5gM6+eNKCQo= MIME-Version: 1.0 Received: by 10.229.42.8 with SMTP id q8mr1577047qce.51.1320967764260; Thu, 10 Nov 2011 15:29:24 -0800 (PST) Received: by 10.229.6.202 with HTTP; Thu, 10 Nov 2011 15:29:24 -0800 (PST) Received: by 10.229.6.202 with HTTP; Thu, 10 Nov 2011 15:29:24 -0800 (PST) In-Reply-To: <4EBC5A86.9050803@gmail.com> References: <4EBC5A86.9050803@gmail.com> Date: Thu, 10 Nov 2011 18:29:24 -0500 Message-ID: To: David Muir Cc: guilhermeblanco@gmail.com, PHP Internals Content-Type: multipart/alternative; boundary=00163642716859399604b169c606 Subject: Re: [PHP-DEV] SPLClassLoader RFC Thoughts And Improvements From: ircmaxell@gmail.com (Anthony Ferrara) --00163642716859399604b169c606 Content-Type: text/plain; charset=ISO-8859-1 Well, the problem with adding methods later is that it will fatal any class that implements the old one. A big no no. You could get around that by doing something like traversable. Provide an empty and non usable core SplAutoloader interface which is typehintable. Then add a child SplClassAutoloader interface which defines loadClass. That way, in the future a new child could be added SplFunctionAutoloader which defines loadFunction. By separating them, you maintain type hinting while enabling backwards compatibility with existing code... Just a thought. On Nov 10, 2011 6:13 PM, "David Muir" wrote: > Surprised to say that I agree on just about everything you mentioned. I > would however love to see a useful autoloader included in core. I have > only one comment below. > > 4. The RFC should avoid implementing any pattern or style that may > > make future feature addition difficult or pose risks towards such. An > > example would be implementing an interface for the autoloader which > > defines something like load($class). The problem there is that if > > function autoloading is added, the interface won't be able to support > > it. So it's stuck in a hard place between changing an implemented > > interface (which will bork code significantly on update) and adding a > > new interface (which would be the lesser of evils, but would just add > > to the deprecated cruft). > > IMO, the interface should just define loadClass($class). It means that > spl_autoload_register has a fixed target for loading classes, and if we > want to support autoloading functions or whatever else later on, a new > interface can be added that would define the appropriate method eg. > loadFunction($function). > > Cheers, > David > > --00163642716859399604b169c606--