Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:79827 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 25036 invoked from network); 20 Dec 2014 22:45:47 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Dec 2014 22:45:47 -0000 Authentication-Results: pb1.pair.com header.from=ajf@ajf.me; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=ajf@ajf.me; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain ajf.me designates 192.64.116.199 as permitted sender) X-PHP-List-Original-Sender: ajf@ajf.me X-Host-Fingerprint: 192.64.116.199 imap11-2.ox.privateemail.com Received: from [192.64.116.199] ([192.64.116.199:35069] helo=imap11-2.ox.privateemail.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id AC/C1-12790-91CF5945 for ; Sat, 20 Dec 2014 17:45:46 -0500 Received: from localhost (localhost [127.0.0.1]) by mail.privateemail.com (Postfix) with ESMTP id 87D628800ED; Sat, 20 Dec 2014 17:45:42 -0500 (EST) X-Virus-Scanned: Debian amavisd-new at imap11.ox.privateemail.com Received: from mail.privateemail.com ([127.0.0.1]) by localhost (imap11.ox.privateemail.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id Jj5NS2ZaRQUe; Sat, 20 Dec 2014 17:45:42 -0500 (EST) Received: from oa-res-26-240.wireless.abdn.ac.uk (oa-res-26-240.wireless.abdn.ac.uk [137.50.26.240]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.privateemail.com (Postfix) with ESMTPSA id 0F9618800E9; Sat, 20 Dec 2014 17:45:41 -0500 (EST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 8.1 \(1993\)) In-Reply-To: <000c01d01ca0$7e70c850$7b5258f0$@yahoo.fr> Date: Sat, 20 Dec 2014 22:45:39 +0000 Cc: internals@lists.php.net Content-Transfer-Encoding: quoted-printable Message-ID: References: <000c01d01ca0$7e70c850$7b5258f0$@yahoo.fr> To: nf.laupretre@yahoo.fr X-Mailer: Apple Mail (2.1993) Subject: Re: [PHP-DEV] Proposal for PHP 7 : case-sensitive symbols From: ajf@ajf.me (Andrea Faulds) Hey Fran=C3=A7ois, (I assume there=E2=80=99s a =C3=A7, I apologise if = not) > On 20 Dec 2014, at 22:01, F & N Laupretre = wrote: >=20 > I don't know if this was discussed before. So, tell me what you think = before > I write an RFC. Ah, this subject has come up before, I think. :) > 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. I=E2=80=99d thought of doing this before, but the = backwards-compatibility cost is too high. I would like to see more case uniformity, but I think this is the less = practical direction. Instead of making everything case-sensitive, we = should make everything case-insensitive, which would break far less = stuff, and is a smaller change. That=E2=80=99d mean constants, variable = names and properties would need changing, everything else is already = case-insensitive.=20 I don=E2=80=99t think making constants and variable names = case-insensitive would cause a problem. I reckon it=E2=80=99s unlikely = that someone has two constants differing only by case, ditto for = variable names, and both live in their own namespaces so this wouldn=E2=80= =99t create conflicts. Even if someone does, this is probably quite a = rare occurrence and could be easily fixed. The problematic case is properties, because although PHP code probably = doesn=E2=80=99t rely on them being case-sensitive most of the time, = lacking preservation of case for serialised properties would be quite a = problem. For example, an object serialised to JSON and then decoded = might, with the right flags passed, be unserialised as an array. Array = keys are case-sensitive in PHP (as they should be, I don=E2=80=99t want = to change that), so now a lookup that worked before might not now = because the case wasn=E2=80=99t preserved. Even if we took care to = preserve case, there=E2=80=99s also the problem of objects used as = associative arrays, which we explicitly encourage with ArrayObject. = Plus, JSON objects decode to PHP objects by default, so objects used as = case-sensitive dictionaries in incoming JSON would break. For these = reasons, I don=E2=80=99t think we should touch properties. In summary, case-sensitivity everywhere would be a massive BC break, but = case-insensitivity for everything except properties might be doable. Thanks for writing! :) -- Andrea Faulds http://ajf.me/