Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:55985 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 81697 invoked from network); 28 Oct 2011 18:13:31 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 28 Oct 2011 18:13:31 -0000 Authentication-Results: pb1.pair.com header.from=nicolas.grekas@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=nicolas.grekas@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.213.42 as permitted sender) X-PHP-List-Original-Sender: nicolas.grekas@gmail.com X-Host-Fingerprint: 209.85.213.42 mail-yw0-f42.google.com Received: from [209.85.213.42] ([209.85.213.42:36033] helo=mail-yw0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id AA/C4-57675-AC0FAAE4 for ; Fri, 28 Oct 2011 14:13:31 -0400 Received: by ywb26 with SMTP id 26so4384198ywb.29 for ; Fri, 28 Oct 2011 11:13:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type; bh=tTtsnzbfiK2/sPSfMaVrSXTf7QgKtTdbLBgFcrt0J0k=; b=FCw3S+gNn2INDkFP+O3ojmYfCGi65dZ+LIzVCXGDFxxzkNwUC8NzeRjnUZCBQYy4ze A+RFNsk/IYZNOWjQ9JfnJDmc8dRruPC86wlfePtKvFHjtRkZPKXqbRm9iOl/FQXpKzRB tDG3BXcINCAl2JwzGxZqqycANcsHMqPEQeHCM= Received: by 10.236.192.132 with SMTP id i4mr5538872yhn.80.1319825608116; Fri, 28 Oct 2011 11:13:28 -0700 (PDT) MIME-Version: 1.0 Sender: nicolas.grekas@gmail.com Received: by 10.236.176.228 with HTTP; Fri, 28 Oct 2011 11:13:07 -0700 (PDT) In-Reply-To: References: Date: Fri, 28 Oct 2011 20:13:07 +0200 X-Google-Sender-Auth: buSkYs2MXH7KXvb7A5-NE9c4YSs Message-ID: To: internals@lists.php.net Cc: mario@include-once.org, guilhermeblanco@gmail.com, "Matthew Weier O'Phinney" , Mike Willbanks Content-Type: multipart/alternative; boundary=20cf3040e36289883704b05fd891 Subject: Re: [PHP-DEV] SplClassLoader and PSR-0 break language semantics From: nicolas.grekas+php@gmail.com (Nicolas Grekas) --20cf3040e36289883704b05fd891 Content-Type: text/plain; charset=ISO-8859-1 To me, the interface found at https://wiki.php.net/rfc/splclassloader is strange : first, to be consistent with PSR-0, why allow changing the extension where PSR-0 states that the only valid one is ".php"? Why also have an interface to change the namespace separator? Concerning userland specialization, I think the interface lacks a way to intercept the path before "require". For example, if I want to preprocess a file before including it, I can't with this code. I find Symfony's interface much more powerful: https://github.com/symfony/symfony/blob/master/src/Symfony/Component/ClassLoader/UniversalClassLoader.php About language semantics, I understand and support this reasoning: 1. case insensitivity is good because having two different classes "Foo" and "foo" makes absolutely no sense, 2. case sensitivity is good because mixing "Foo" and "foo" usage makes absolutely no sense. So, having a case sensitive loader is an extremely good thing because of 2. And having a case insensitive PHP engine is also good because of 1. To go a little further, I even think that PHP should trigger an E_STRICT when a class is used with mixed case (first time "Foo", later "foo") but that's for another topic :) To me, PHP current's behavior enforces 1., which is good, but PHP can't encourage mixing "Foo" and "foo", so no semantic is broken when the filesystem is case sensitive. About PSR-0 and applying the same reasoning, I don't understand why the underscore in the namespace part is not replaced by a directory separator: because of it's class to path transformation, PSR-0 forbids having two different classes named A\B_C and A\B\C (they map to the same file). That is a good think, same reasoning for 1. above. But because of the "underscore in namespace exception", PSR-0 encourages a situation where class A_B\C can coexists with an other class A\B\C. Why forbid A\B_C and A\B\C, then allow A_B\C and A\B\C? That is inconsistent with argument 1. above, which we have used to justify PSR-0 equivalence for A\B_C and A\B\C... That is inconsistent to me. Hope it helps :) Nicolas --20cf3040e36289883704b05fd891--