Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:56066 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 97311 invoked from network); 4 Nov 2011 10:43:27 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 4 Nov 2011 10:43:27 -0000 Authentication-Results: pb1.pair.com smtp.mail=jbondc@openmv.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=jbondc@openmv.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain openmv.com from 64.15.152.204 cause and error) X-PHP-List-Original-Sender: jbondc@openmv.com X-Host-Fingerprint: 64.15.152.204 mail.ca.gdesolutions.com Received: from [64.15.152.204] ([64.15.152.204:51668] helo=mail.ca.gdesolutions.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 85/11-23221-EC1C3BE4 for ; Fri, 04 Nov 2011 05:43:26 -0500 Received: from localhost (localhost [127.0.0.1]) by mail.ca.gdesolutions.com (Postfix) with ESMTP id 8FF415DC2; Fri, 4 Nov 2011 06:43:23 -0400 (EDT) X-Virus-Scanned: amavisd-new at gdesolutions.com Received: from mail.ca.gdesolutions.com ([127.0.0.1]) by localhost (mail.ca.gdesolutions.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id d2mvT-m7zL1u; Fri, 4 Nov 2011 06:43:22 -0400 (EDT) Received: from djbondc (modemcable166.116-70-69.static.videotron.ca [69.70.116.166]) by mail.ca.gdesolutions.com (Postfix) with ESMTPSA id 744135DC1; Fri, 4 Nov 2011 06:43:22 -0400 (EDT) To: "'Will Fitch'" Cc: "'Anthony Ferrara'" , "'PHP Internals List'" References: <4E208FE7.4020606@sugarcrm.com> <00d401cc9a59$ccf273b0$66d75b10$@com> <68B9654F-EFF9-41FE-866D-B2F838C3AFCE@gmail.com> In-Reply-To: <68B9654F-EFF9-41FE-866D-B2F838C3AFCE@gmail.com> Date: Fri, 4 Nov 2011 06:43:21 -0400 Message-ID: <002f01cc9ade$92c62c60$b8528520$@com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 12.0 Thread-Index: AcyaXE3P8Epj+VxURheEvjX5NIM0qQAf+5lQ Content-Language: en-ca Subject: RE: [PHP-DEV] SplClassLoader From: jbondc@openmv.com ("Jonathan Bond-Caron") On Thu Nov 3 03:06 PM, Will Fitch wrote: > Wouldn't you consider spl_autoload_register an interoperability > solution? Only your defined autoloading function would then need to > know how your file system is structured, there'd be no need for > include_path declarations and you wouldn't have to explicitly declare > paths for each class. > The problem with spl_autoload_register() is it isn't clear what the autoloading function is supposed to do if the class if not found. So no I don't think spl_autoload_register() solves an interoperability problem. SplClassLoader somewhat does a better job by forcing a common implementation... function FrameworkA_autoload($class) { if( !isset($AmapToFile[$class]) ) throw new Exception('Class '. $class . ' not found!'); include_once($AmapToFile[$class]); } function FrameworkB_autoload($class) { require_once($BmapToFile[$class]); } function FrameworkC_autoload($class) { include_once($CmapToFile[$class]); } spl_autoload_register('FrameworkA_autoload'); spl_autoload_register('FrameworkB_autoload'); spl_autoload_register('FrameworkC_autoload'); So both 'FrameworkB_autoload', 'FrameworkC_autoload' are never called. Btw, I would hope that any 'standard' would actually that try to talk about other autoloaders and how they should behave. https://gist.github.com/221634 See comments about include() or require()