Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:108024 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 28663 invoked from network); 7 Jan 2020 12:37:35 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 7 Jan 2020 12:37:35 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id BFCA41804D1 for ; Tue, 7 Jan 2020 02:42:41 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-io1-f47.google.com (mail-io1-f47.google.com [209.85.166.47]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Tue, 7 Jan 2020 02:42:41 -0800 (PST) Received: by mail-io1-f47.google.com with SMTP id d15so8649725iog.3 for ; Tue, 07 Jan 2020 02:42:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=disbq+LWmrTbLFqPUSjmSawymGb7pTgPxoe/kT4xBmU=; b=pt/E04Lq74tb3hzwZaSd2SEgiqxkxIf01vorzWsbeG4YkQ/mjOhJTR32DpUcFn1SGo t0yl72WRmYBDBGnywmOTn/5VdQUCz4kC9WMxMxWZlL2k4CnCvEsIiJPGMziLkY/JczGx aAfXhpntvb95+WvmDk9QoKqMt0PC3YMlp5+CP7qE/jzeK2UKexugXRpBIleTp5DNo21y xwFITmWqohRMWynM+i+8PD+bU39mKdVFtBWBKj2/Yd1D7odp3dPUB7ZQaP5EQnFFpcV4 aUp6QElVGoxQdTTz3oqCzpJaqTau1i8u49X84DGe7esp/tofNo5DLUkiZtDmYPP/TUm6 zUDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=disbq+LWmrTbLFqPUSjmSawymGb7pTgPxoe/kT4xBmU=; b=OJ5n/wP6tof7Jlb8VKJ1wPUXwkFDM58IQl0tJbeur/DTE2m2bWJKur1YM9HHaRACwo gduwrWiZkIy8QIQGvLjKdzPGq9qlOUf+mElVms1ziJ7ApdospV2pr/7q31zonyX6DOO9 gqshAvFEiwoIReScXtaaHKZnLqUcrZ95eHjVvan1cfVMrkaODFg1REbW/40TM9XLPb4t J/+KqZcIvf5sUYFBxGk5Kchcz+AgX6ZeCD9hArZaCo3fUl+MeMLpNPUZox8i01wafDW7 /1OPZ91uABXjovYlWtsHypCgEEKVUnAf3DIJHIWyv72nEmRt+bfMFKfEBslaz13pNQyk lM+g== X-Gm-Message-State: APjAAAXRyf4NN5BQNyEcCd8W98xX8EFY7kIwhJ+Uo+FjJQZtP/v8FsUQ UN7L1RNtTMXzoURU0yucXC5fIv7/T165yPvge6xEEFjL X-Google-Smtp-Source: APXvYqxk759/Tw1G23ITfzvInJJp7ydw71Xrf9Zwxl+wVqsJxyyido20u4l9TqdrpH7RerklFklQzEuS4BXgO7YYJZs= X-Received: by 2002:a02:cc75:: with SMTP id j21mr81793021jaq.113.1578393757306; Tue, 07 Jan 2020 02:42:37 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: Date: Tue, 7 Jan 2020 10:42:26 +0000 Message-ID: To: PHP internals Content-Type: multipart/alternative; boundary="00000000000038565a059b8a6ff6" Subject: Re: [PHP-DEV] [RFC] Variable syntax tweaks From: rowan.collins@gmail.com (Rowan Tommins) --00000000000038565a059b8a6ff6 Content-Type: text/plain; charset="UTF-8" On Tue, 7 Jan 2020 at 10:23, Nikita Popov wrote: > I'd like to propose a small RFC, which addresses a few minor issues that > have not been handled by the original "uniform variable syntax" RFC: > > https://wiki.php.net/rfc/variable_syntax_tweaks Hi Nikita, Thanks for this, I'm definitely a fan of this kind of consistency, even if it rarely matters in practice. :) Regarding instanceof, and specifically your last alternative: > The second possibility is to relax the restrictions around the right-hand-side of instanceof entirely. This would involve treating it as a normal expression, and then reinterpreting plain constant accesses as class name references instead. Am I right in thinking that another disadvantage of this is that you couldn't use a bare constant to define a class name, thus introducing a new inconsistency? That is, using a bracketed form, it should be possible to write: const CLASS_NAME='MyClass'; var_dump( $string instanceof {CLASS_NAME} ); or: const CLASS_NAME='MyClass'; var_dump( $string instanceof (CLASS_NAME) ); but using the "reinterpreted expression" option, you'd need to do something hacky to force the interpretation as a constant, like: const CLASS_NAME='MyClass'; var_dump( $string instanceof ('' . CLASS_NAME) ); Another edge case of an edge case, of course, but a mark against that option in my view. :) Regards, -- Rowan Tommins [IMSoP] --00000000000038565a059b8a6ff6--