Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:91212 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 433 invoked from network); 11 Feb 2016 18:11:30 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 11 Feb 2016 18:11:30 -0000 Authentication-Results: pb1.pair.com smtp.mail=smalyshev@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=smalyshev@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.220.43 as permitted sender) X-PHP-List-Original-Sender: smalyshev@gmail.com X-Host-Fingerprint: 209.85.220.43 mail-pa0-f43.google.com Received: from [209.85.220.43] ([209.85.220.43:35071] helo=mail-pa0-f43.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id D0/1E-25203-1DECCB65 for ; Thu, 11 Feb 2016 13:11:30 -0500 Received: by mail-pa0-f43.google.com with SMTP id ho8so32592956pac.2 for ; Thu, 11 Feb 2016 10:11:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:to:references:cc:from:message-id:date:user-agent :mime-version:in-reply-to:content-type:content-transfer-encoding; bh=O9hhqipiXLl9L2qo2ImHP+nUs860Jbc4j6bI74tbax4=; b=EshQQ6SjBl0prUrQfBYBb6Mqtd4n1k5Krrmj4frlWZ6m6PH5IPVjovDTGDYJhs0VIC F0RdzcN7gzvN37y5YZkBu1SGOr5xkCEoCfdSMnXz2FT0+QQxSUsCTpjEinQiHF+5lOn5 rSWg80zgR8UEF6WsGS4ryCi7vgweOz5/vpK8j7+2hYGKlaxwMY+TJ4ykYc5v6dw0sHMk NfNfYRyVMrusWUVU5G8nQALRb2f01UiIrER7lMUFr+Ha8acLx6poXUr6DhRCcatYhuV2 EzGKIu70KTLxvh8YKcHXabye/JjQi1Lbx4aiZOmctMqT2xIPBambQDUquOHTkUHGTK9Q jsdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:cc:from:message-id:date :user-agent:mime-version:in-reply-to:content-type :content-transfer-encoding; bh=O9hhqipiXLl9L2qo2ImHP+nUs860Jbc4j6bI74tbax4=; b=Tnawj7Wf3+Zy0azigPpeEaqOntaUdelAXrX6FGTEt/atZdRg6G1TQKbfl2JTdqTxbk C//WqeB9XrSgYDon7QRFVikqLHHDvC9l5OEh1W4GybnIoq3mEkoG7tRgGs3K6lPoyO+B JL/8PmVzOmF1K/2RS+KaqnJr88TvHlRtSgRtayz28/oeDVE0iXqO/sZhE4H4nD1rPWea RqjL83DjodYzg6N2H/tUEXLaFO8VtueuXan5jBzwVsN6EM6qUMqwjJU+nB+vqcqLWxRu gHlbIpBG5+rmCPG9HL4nqf/IVyVCEd/ysK0NPuyDzLKRdWMNeJdkwvKRQel4ggTs5Bd9 1UJw== X-Gm-Message-State: AG10YOTc6cvMcb07BGDAeKvTwDe5EHEyX8PV/v9f6JDrFRAWFktVnd6cEa7IlGDW2Gb5pA== X-Received: by 10.67.6.1 with SMTP id cq1mr67831843pad.78.1455214287203; Thu, 11 Feb 2016 10:11:27 -0800 (PST) Received: from Stas-Air.local (tan1.corp.wikimedia.org. [198.73.209.1]) by smtp.gmail.com with ESMTPSA id b63sm13844865pfj.25.2016.02.11.10.11.26 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 11 Feb 2016 10:11:26 -0800 (PST) To: Nikita Popov , Rowan Collins References: <56A3A01F.1020500@php.net> <56BB4A5F.3060906@php.net> <56BC29C8.9070308@gmail.com> <56BC3372.1010308@gmail.com> <56BC7BB6.6070705@gmx.de> <56BC829C.1040608@gmail.com> Cc: PHP internals Message-ID: <56BCCECD.5000009@gmail.com> Date: Thu, 11 Feb 2016 10:11:25 -0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] [RFC] Generalize support of negative string offsets From: smalyshev@gmail.com (Stanislav Malyshev) Hi! > Just having a different syntax, writing $foo{0} = 'zzz' instead of $foo[0] > = 'zzz' does not make the implicit truncation behavior any more obvious or > reasonable. If we want to actually make it less confusing, what we should It makes it clear the operation you are dealing with is not array access and is not bound by its rules, but another operation with (possibly) different rules which you need to learn. > Similarly, Stas' comments on how things like $string[0] ^= "\xf0" do no > work, are not a reason to promote a different string offset syntax -- that > wouldn't actually *solve* anything. Instead we should strive to make these That would solve the situation where we imply that strings are like arrays by using same syntax only to break that promise with many operations. > things work as expected. If I can write $string[0] = $string[0] ^ "\xf0" it > stands to reason that $string[0] ^= "\xf0" should work as well. That would be much harder to do and largely pointless unless we make string offsets be real zvals. Which I strongly recommend against - we have enough trouble with pointer-like nature of references, one more pointer-like time would produce huge amount of trouble. -- Stas Malyshev smalyshev@gmail.com