Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:98126 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 3997 invoked from network); 2 Feb 2017 21:47:41 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 2 Feb 2017 21:47:41 -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 74.125.82.41 as permitted sender) X-PHP-List-Original-Sender: rowan.collins@gmail.com X-Host-Fingerprint: 74.125.82.41 mail-wm0-f41.google.com Received: from [74.125.82.41] ([74.125.82.41:35807] helo=mail-wm0-f41.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id EE/EF-51557-CF8A3985 for ; Thu, 02 Feb 2017 16:47:41 -0500 Received: by mail-wm0-f41.google.com with SMTP id b65so111786586wmf.0 for ; Thu, 02 Feb 2017 13:47:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:cc:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=itBq20huYk02EM3vh2gtwkrRkUS8yVwzEsxCaR8Y1QY=; b=dIhn9wGZgyjfTlFuhj3pOSdF3RwuYdNfMXC0kG9jpz5SCGdWvE50Wxwf5CiF3cvNKW yG4kr48LTI78dxM87k0X8khB02Iseh1xTjcZyg4GfLGKcm0X/HlTacSgMWI+0Wihvr+b livsHG/bZGaa/Vyl4tcHd5CVd2u/4fVewKanno+nRZhKiGK1/yomL52i8TtuDWIPmrMw kd5Q6ql2Ro/Qzlp+WlgTcBlovsU1F8XEihybYgPYDLeluBlHqn8smm/Oge2XAQCTgRww +I+GGHWWl7tJhf6Fopwuu/wop7Sn2qUBgNki1ZEiD6acxPBGr09bh7LUi4EjnF78MDN3 f32w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:cc:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=itBq20huYk02EM3vh2gtwkrRkUS8yVwzEsxCaR8Y1QY=; b=A/BDprsl2CSyMOh+Hgb7CnbHQZu4G8wBQfUwR+GXzWP1PfZTz3FV0uwk3baJOccAWp XE+tUPOVVpqsyhkuMyVe0Bib2izhciV7lvIvnQ+0T2u/0Yrn3Yt9I1HchLCvkzicaPQ9 gAwJwgzKpyKMzKv8ID9myib59HYTa9zNf450q0SR+QXZnLsx7++nS2O4Q5cTCZSAwrRC oeUUtk1lfJ1NPEyuEP/aH9WycYwgNw4Ln840aRI4edfu0t+c83E/hzjLlkNn0sddfD4J 7Dii80VfRV7IDX3zNI08UfamVdxKqLz1pyNSO9jl0gaEQ8tMyenkuwRsuLWO15O62eDv x74w== X-Gm-Message-State: AIkVDXKum1mAD0R1QH5IrMwdH5Jdv6sPGbwhektOUSE/AwKVN1iNM54NbHqW5Jv2CF6UTQ== X-Received: by 10.28.215.206 with SMTP id o197mr10715815wmg.31.1486072057750; Thu, 02 Feb 2017 13:47:37 -0800 (PST) Received: from ?IPv6:2a00:23c4:4bd2:6e00:843f:f93d:6f6e:95f4? ([2a00:23c4:4bd2:6e00:843f:f93d:6f6e:95f4]) by smtp.googlemail.com with ESMTPSA id a35sm42101150wra.21.2017.02.02.13.47.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 02 Feb 2017 13:47:36 -0800 (PST) To: PHP Internals References: <0c5fc86b-5050-fe73-7afa-b3e5a38ad370@gmail.com> <1485902801.28761.5.camel@kuechenschabe> <1485902993.28761.7.camel@kuechenschabe> <26102ac0-61f4-446e-7ac1-ccf879a58f94@gmx.de> Cc: =?UTF-8?Q?Johannes_Schl=c3=bcter?= Message-ID: Date: Thu, 2 Feb 2017 21:47:34 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0 MIME-Version: 1.0 In-Reply-To: <26102ac0-61f4-446e-7ac1-ccf879a58f94@gmx.de> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: [PHP-DEV] [RFC] Deprecate and Remove Bareword (Unquoted) Strings From: rowan.collins@gmail.com (Rowan Collins) > On 31.01.2017 at 23:49, Johannes Schlüter wrote: > There is another context where unquoted strings are used: > > $a = [ "foo" => "bar" ]; > echo "Let's go and have a drink in a $a[foo]!"; On 01/02/2017 23:12, Christoph M. Becker wrote: > This is explicitly mentioned in the RFC's "Unaffected PHP Functionality" > section[1]. The RFC suggest to keep this shortcut. Indeed, thanks to whoever put that section in the RFC template. :) I do think it is a rather odd syntax rule, and not one I would include if designing PHP from scratch, particularly since putting single quotes around the key... echo "Let's go and have a drink in a $a['foo']!"; ...results in a rather surprising error: Parse error: syntax error, unexpected '' (T_ENCAPSED_AND_WHITESPACE), expecting identifier (T_STRING) or variable (T_VARIABLE) or number (T_NUM_STRING) The most consistent interpretation would actually be for the [ to be treated as just part of the string, which would never be a useful result: Notice: Array to string conversion Let's go and have a drink in a Array[foo]! It's just possible that someone would expect "$message[E_WARNING]" to look up the constant, but since it *never* does, this is less likely to cause the kind of subtle bugs I describe in the RFC. Plus this syntax is documented and recommended, whereas the one I propose to remove appears to have never been either of those things. > Oh and there's another case: > > foo.php?a[foo]=bar I hadn't thought of that one; I'll add it to the RFC as also not changing, for all the same reasons. Indeed, this one has no ambiguity at all, since there is no scope where constants could be defined in order to populate it. > I'm not saying we have to change those. But I believe the symmetry there > is part of the historic reason. Unless Rasmus, Zeev, or Andy venture down memory lane and tell us otherwise, I think that's a reasonable theory. The fallback is certainly usually mentioned when talking about array keys, even though it applies to any bare word the parser sees. Regards, -- Rowan Collins [IMSoP]