Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:100559 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 92891 invoked from network); 13 Sep 2017 13:48:45 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 13 Sep 2017 13:48:45 -0000 Authentication-Results: pb1.pair.com smtp.mail=rowan.collins@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=rowan.collins@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.128.178 as permitted sender) X-PHP-List-Original-Sender: rowan.collins@gmail.com X-Host-Fingerprint: 209.85.128.178 mail-wr0-f178.google.com Received: from [209.85.128.178] ([209.85.128.178:43745] helo=mail-wr0-f178.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id AA/C0-19300-C3739B95 for ; Wed, 13 Sep 2017 09:48:45 -0400 Received: by mail-wr0-f178.google.com with SMTP id a43so664969wrc.0 for ; Wed, 13 Sep 2017 06:48:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:user-agent:in-reply-to:references:mime-version :content-transfer-encoding:subject:cc:from:message-id; bh=7bncoZv2rUGYe1TCk7aGZvxbkCk+EJVQGhoSOqDBPAs=; b=ACXd/RqcLjfWA6KwL0dvFL5+KotXBqvfnq4iH9rBnpw4ONqXiBAQ/zyLk2zjSQJ8pQ IQx2XkU3gboQOIxk8rx4iRMioqb3v+4MvMs3lKgQGYRddRYkVMDXgDak1sk/eNZCsRMO xGAXMBQaCiQFsKOUk4CimreCqH9prhg25qjnuas4ZTJcc/m/lyI28BEXfTQiHRiOi9Bk QQr6Tv6eCO8amujQPtpb18CMbwrPwco4JjcRQ/E/zGi6rJDI8nBu5UyJ0GOZzgUfvVJf v8Nj/ZdxihVMT/wqC/uqCfhk7G647e6lhPij/3EZ19iO7TuYPOU6vdkKB/ckZMuKhGib KdEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:user-agent:in-reply-to:references :mime-version:content-transfer-encoding:subject:cc:from:message-id; bh=7bncoZv2rUGYe1TCk7aGZvxbkCk+EJVQGhoSOqDBPAs=; b=MXXnCmE1s04K67uNEDSbKjYCZyUyhv4hNJ7fq5Zdj7O++wBj8W1i/feYaAyKrtFZ8M 5BAQnsjO/KhPv4RLktQGXRvLBCFKO1+fWHGJxptiaJkP5igeWFewR9Ojv1uX6NIxhxQ3 msM4fSWnRyAbMKvzyDWhuUMghqCmWU61kOf1Da9c/uDNSqhEZe6uPnXH4voM6eluz98B nlyVd8k/d7aO4QZuYnyYPNmuLzaJ/5mXkL900cFgirpmojM7PV4/QyvOV7NTNSintaUj E8/WMhWJeVdyFI5Xpp1VytB7o4Linp22BHkK1G5q2nInv9gfLA8wLzbNdk4BfwqypjBM llfg== X-Gm-Message-State: AHPjjUiO9mCBxFbf+ajrxqUlXOOiKadyb8A2XWvE/cGRqd3m78dDUeRO +mOAF5lFlLeBhmRUMdE= X-Google-Smtp-Source: ADKCNb7b0Rz3bTNWVgzahlXbU4RSUFWDWzWNT250Xx8+zE2IoMZqOcnXLyRAVMbITWk4jr6UVq0hiQ== X-Received: by 10.223.157.11 with SMTP id k11mr17142327wre.252.1505310521888; Wed, 13 Sep 2017 06:48:41 -0700 (PDT) Received: from [10.7.33.111] (188.29.164.150.threembb.co.uk. [188.29.164.150]) by smtp.gmail.com with ESMTPSA id s86sm1172144wma.24.2017.09.13.06.48.40 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 Sep 2017 06:48:40 -0700 (PDT) Date: Wed, 13 Sep 2017 14:48:38 +0100 User-Agent: K-9 Mail for Android In-Reply-To: References: <6601584d-c76d-4ed7-b4d6-b95e1b401cae@tekwire.net> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----98JTDPEZR42H7X2H6K9LUQS1FGNEBR" Content-Transfer-Encoding: 7bit CC: internals Message-ID: Subject: Re: [PHP-DEV] Deprecate and remove case-insensitive constants? From: rowan.collins@gmail.com (Rowan Collins) ------98JTDPEZR42H7X2H6K9LUQS1FGNEBR Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Regards, On 12 September 2017 21:35:51 BST, Levi Morrison wrote: >On Tue, Sep 12, 2017 at 11:59 AM, Rowan Collins > wrote: >>>> If we want function and class references, they should have their >own, >>>>unambiguous, syntax=2E >> >> I stand by this assertion=2E Consider the following statement: >> >> $foo =3D bar; >> >> Even if "bar" cannot *simultaneously* be the name of a function, a >class, and a constant, it can still *potentially* be any of the three, >from the point of view of the compiler=2E > >If it's known, it's known, and it can proceed with that type=2E If it's >not known then autoload and proceed like normal=2E I fail to see how >this is an issue, and in fact, see it as a *significant* improvement >to our current situation=2E=2E=2E If the symbol tables had always been unified, I guess you could think of a= function name as a constant whose value happened to be of type IS_FUNC - l= ike how in JS "function foo() {}" and "var foo =3D function{}" are very nea= rly interchangeable=2E But it feels like retrofitting that onto the existin= g language would be messy=2E For instance, an autoloader would have to be given a token name, with no c= ontext of whether it's expected to be a class, function, or constant=2E (Of= course we'd have to solve the dilemma of how global function fallback/shad= owing should interact with autoloading first=2E) Users would have to learn = this concept of an untyped token, because the error message they'd get if i= t wasn't defined could no longer say "undefined constant"=2E Then there's all the existing support for string-based callables=2E I can'= t actually think of any cases that are unresolvable, but there's some odd i= mplications: function foo() { echo 'Hello, world!'; } const bar=3D'foo'; $fn =3D bar; $fn(); // already works bar(); // would this work? if not, why not, since it's no longer ambiguous= ? const baz=3D'bar'; $fn2 =3D baz; $fn2(); // in which case, would this also work? baz(); // and then what about this? I feel like this could lead to confusion either way, and just increase the= complexity for both human and machine analysis=2E Then there's other symbol tables that would need to be unified - we'd want= $foo->bar be able to grant a method reference, and Foo::bar a static metho= d reference=2E Just how much code is it worth breaking to allow this syntax= ? It feels a lot cleaner to say "function and class references are a new con= cept, and you'll know when you're using them because they look like this"= =2E Something like "SomeClass::classref", "some_func::funcref", "SomeClass:= :someStaticMethod::funcref", "$some_object->someMethod::funcref"=2E =C2=A0 --=20 Rowan Collins [IMSoP] ------98JTDPEZR42H7X2H6K9LUQS1FGNEBR--