Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:81108 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 43444 invoked from network); 25 Jan 2015 05:55:22 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 25 Jan 2015 05:55:22 -0000 Authentication-Results: pb1.pair.com header.from=francois@tekwire.net; sender-id=softfail Authentication-Results: pb1.pair.com smtp.mail=francois@tekwire.net; spf=softfail; sender-id=softfail Received-SPF: softfail (pb1.pair.com: domain tekwire.net does not designate 212.27.42.2 as permitted sender) X-PHP-List-Original-Sender: francois@tekwire.net X-Host-Fingerprint: 212.27.42.2 smtp2-g21.free.fr Received: from [212.27.42.2] ([212.27.42.2:43005] helo=smtp2-g21.free.fr) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 66/90-36889-84584C45 for ; Sun, 25 Jan 2015 00:55:21 -0500 Received: from moorea (unknown [82.240.16.115]) by smtp2-g21.free.fr (Postfix) with ESMTP id 2F3014B0188; Sun, 25 Jan 2015 06:52:30 +0100 (CET) Reply-To: To: "'Yasuo Ohgaki'" Cc: References: <000c01d01ca0$7e70c850$7b5258f0$@yahoo.fr> In-Reply-To: Date: Sun, 25 Jan 2015 06:55:14 +0100 Message-ID: <003f01d03863$7de43550$79ac9ff0$@tekwire.net> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Outlook 14.0 Thread-Index: AQHy2TXkJ8WGpUhO4XSbKZAIVj0P4QFi4wcDnH/y3pA= Content-Language: fr X-Antivirus: avast! (VPS 150124-1, 24/01/2015), Outbound message X-Antivirus-Status: Clean Subject: RE: [PHP-DEV] Proposal for PHP 7 : case-sensitive symbols From: francois@tekwire.net (=?UTF-8?Q?Fran=C3=A7ois_Laupretre?=) Hi, > De : yohgaki@gmail.com [mailto:yohgaki@gmail.com] De la part de Yasuo = Ohgaki > > > I would like to propose that namespaces, functions, and classes = become > > case-sensitive (constants are already case-sensitive). Actually, I = never > > understood why they are case-insensitive. Even if the performance = gain is > > negligible, I think it could be the right time to question this. > > >=20 > I'm writing this mail without reading current zend code. >=20 > Anyway, is it feasible to raise E_DEPRECATE without much performance > penalty? > For example, >=20 > if (!strcmp(name, name_to_be_searched)) { > do_something; > } else if (!strcasecmp(name, name_to_be_searched) { > rase_error; > do_something; > } >=20 > Duplicated codes may be removed by macro. strcasecmp() checks may be > removed > 10 years later or more. Unfortunately, raising an E_DEPRECATED on case-sensitive mismatch is a = huge work, as case-insensitivity appears in a lot of locations = throughout the core. And the macro approach is not possible. Actually, case insensitivity goes well beyond class and function names: = it also includes namespaces, scope resolution operators (self, parent, = static), class magic methods, method names (properties are already = case-sensitive), language keywords, and some stream wrapper protocols = (like file and zlib). All these case insensitive comparisons are done in = a variety of ways, at various locations in the code. Most store and = compare names converted to lowercase (which implies a problem with = Unicode as correct conversion with an unknown character set is = impossible), some use strncasecmp... So, making the code case-sensitive would be a important work, but = raising an E_DEPRECATED message would require much more work. = Unfortunately, you can forget the idea of a macro that can be removed = anytime in the future :) Cheers Fran=C3=A7ois