Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:100541 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 6858 invoked from network); 12 Sep 2017 14:52:44 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 12 Sep 2017 14:52:44 -0000 Authentication-Results: pb1.pair.com smtp.mail=morrison.levi@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=morrison.levi@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.54 as permitted sender) X-PHP-List-Original-Sender: morrison.levi@gmail.com X-Host-Fingerprint: 74.125.82.54 mail-wm0-f54.google.com Received: from [74.125.82.54] ([74.125.82.54:46071] helo=mail-wm0-f54.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 5D/14-10715-AB4F7B95 for ; Tue, 12 Sep 2017 10:52:42 -0400 Received: by mail-wm0-f54.google.com with SMTP id f199so59281349wme.0 for ; Tue, 12 Sep 2017 07:52:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-transfer-encoding; bh=24f4/U6w3H4xQEsfE6PbjEGn0O8vCTjU0F26N2qZagE=; b=QZPSgnue7ZQ2AAFCt/24FZ+WvjTtLxX2Xuhdz+9FOj1j6KzyVd5A99Tg4HdeVIiNQB 9T2AytQnpfSjOWHm6J/lPQnCvkM1FVhxu12zoZne1n0PUJrQoyNyMqfhhpP3LOzvhv1p 1J9oRAcg2ap0ISTh4CDNn6mIa4K5Wzaz6l0A11hvd6zZX81/35t3DcO8nuUxRw17LN/b rIQ02+QDmjACzXDAxxWmDrKiq3LWN53qlic9v+60SaDghqoZT59kgnZEH8pZPV/H6jH/ YSogBStk3G4Adt4OCpC29mURXyc3Q9a5ab+RikB1fX50t9xI7pF1TAmJxBvk3SqWCiew GU9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc:content-transfer-encoding; bh=24f4/U6w3H4xQEsfE6PbjEGn0O8vCTjU0F26N2qZagE=; b=Xb3rZ6PCN5r2MKveyA0vYev7w6TQRij/e0vSyVZNPfG1CLc/yDRXF4FhAP8Z61vsPc SC4UEuQSh/5g3NSQP5WWrvZaZcQFYzHheI++2D74+gc1u1EBHaB2J6DmfuHOBz91fFuU aaKP0GOgBX9vgqoXnUR/iGJFy+vx6rd6/fncQEFfuEo/70T2QFemJcIIX5+IXSw7Ij/0 RQLulv3VBNbIY65BL8zpiIrL5PpZIeJ2zRPe64u8KJ/7j7mVYPRIOj/rmh6APjoOOOVa MmI5HGwf1j7+rz9m7g2Hwz4QgUBpYOdZ36DeLGU+8serY6znHRGXC5DTzyIkbB3/ijb1 FZ9Q== X-Gm-Message-State: AHPjjUgEnn+IH8gL998L/0YnVsH54dVQkOys1HzxWGQjzRPJPTKhNnQ6 C1e4pBmcdKGb3brQB+ux7zT1uzVvaGklwjx8FTTPJlN4 X-Google-Smtp-Source: AOwi7QA3WdHKt+dLyqnAP6SKp+4AcnMSnBnS6f3POmU7/xic2N7bIioQz+JO62+2hx5f6l30kIjItRFGeMzQbxbYE1g= X-Received: by 10.28.140.73 with SMTP id o70mr74596wmd.154.1505227959498; Tue, 12 Sep 2017 07:52:39 -0700 (PDT) MIME-Version: 1.0 Sender: morrison.levi@gmail.com Received: by 10.28.193.130 with HTTP; Tue, 12 Sep 2017 07:52:38 -0700 (PDT) In-Reply-To: <6601584d-c76d-4ed7-b4d6-b95e1b401cae@tekwire.net> References: <6601584d-c76d-4ed7-b4d6-b95e1b401cae@tekwire.net> Date: Tue, 12 Sep 2017 08:52:38 -0600 X-Google-Sender-Auth: YaI24yL3lhbJ54qcfS7TT5k_MBc Message-ID: To: =?UTF-8?Q?Fran=C3=A7ois_Laupretre?= Cc: "Christoph M. Becker" , "internals@lists.php.net" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] Deprecate and remove case-insensitive constants? From: levim@php.net (Levi Morrison) On Tue, Sep 12, 2017 at 6:52 AM, Fran=C3=A7ois Laupretre wrote: > Hi, > > Le 12/09/2017 =C3=A0 14:02, Christoph M. Becker a =C3=A9crit : >> >> Hi everybody! >> >> Usually constant identifiers are treated case-sensitive in PHP. This is >> always the case for constants defined via a `const` declaration. >> However, define() allows to pass TRUE as third argument to define a >> case-insensitive constant. This feature appears to potentially result >> in confusion, and also causes bugs as shown in >> . See an example created by Nikita to see >> some probably unexpected behavior: . >> >> Even if these issues could be resolved, I still think allowing both >> case-sensitive and case-insensitive constant identifiers does more harm >> than good, so either case-sensitive or case-insensitive constant >> identifiers should be removed from the language. Since case-sensitive >> constant identifiers are already the default, and HHVM doesn't even >> support case-insensitive identifiers at all, I would suggest to remove >> case-insensitive constant identifiers. >> >> This could be implemented by triggering E_DEPRECATED whenever the third >> argument to define() is TRUE in PHP 7.3, and to remove this parameter >> altogether in PHP 8. Most likely some further simplification in the >> engine could be done then as well. >> >> Thoughts? > > > What about making PHP 8 100% case-sensitive (except true/false) ? If we > announce it years in advance, it is possible, IMO. > > Regards > > Fran=C3=A7ois > > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php By itself this change provides little value. If it was done in connection with other features such as merging symbol tables then we can actually gain some significant improvements: array_map(sum2, $input1, $input2); Currently that requires `sum2` to be a constant. To get the correct behavior we currently need to do: array_map('fully\qualified\namespace\sum2', $input1, $input2); This is not just convenience; it provides safety to refactoring and general code analysis tools. Maintenance is a crucial aspect of large code bases and being able to move away from stringly-typed things is a significant improvement. It's also a step towards general autoloading instead of just class/trait/interface autoloading; however this would require further changes. I believe these improvements would be worth it and do understand it is a large backwards compatibility break. Given sufficient time and tooling to prepare I think PHP would be markedly better in the long-run for these two changes. However, if we change only the case sensitivity of constants we gain little value for our BC break.