Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:91043 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 37014 invoked from network); 1 Feb 2016 09:41:42 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 1 Feb 2016 09:41:42 -0000 Authentication-Results: pb1.pair.com header.from=julienpauli@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=julienpauli@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.44 as permitted sender) X-PHP-List-Original-Sender: julienpauli@gmail.com X-Host-Fingerprint: 74.125.82.44 mail-wm0-f44.google.com Received: from [74.125.82.44] ([74.125.82.44:38136] helo=mail-wm0-f44.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id F9/A5-07168-3582FA65 for ; Mon, 01 Feb 2016 04:41:40 -0500 Received: by mail-wm0-f44.google.com with SMTP id p63so61752078wmp.1 for ; Mon, 01 Feb 2016 01:41:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=qbUzUMON/wxrTutHew0vM5x5c/lbY2DtfFly3BB5dc8=; b=GJYRYl3oM8URpnxWD0i5lZv6aAi8cEzenStfeN5HED5Se73G+tZerW0GYgSBSfOGR2 grhHFz6qzIRXS9rULlFUrt93CEdX5qiHV2nrQCEQbN8KAd4uiv+ESDFi+1R33MbFOgjG Z+GW2MxomCXWwMaTa4Nh25IHIyhEytG+B/rdVgifQSNmqzi6n/0/xZ6X2RBljjahJ98F UNXV965ykfeOIJCB97qNjZ6UeFDShj/WsT3xaih5aG/tEf7oVlFL/0srpinxkDxQ04Be QmUH7YYeNGRRmRB853EKDmegBRH6bhZrpoesOV0Y2ZYmPsZkRefH/ngUA9XHKBxiaqg/ ElMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc:content-type; bh=qbUzUMON/wxrTutHew0vM5x5c/lbY2DtfFly3BB5dc8=; b=Di1AxqAF8gdeMvUVEBlRRaXhET1x7xgNG8VycfprDN/6OjYN0uq0tw0rdc6TWNr+lb 47AwKvR5APumNDUWdIRpwtaoPRhpkySHt4btpId8laetIDOKES78RzkxcaaFvD62RJ9P PoKFrQbdwvDMs5z0i/AnQb9WpmbFMw+YBKbEP+/ghRcA+c0cS3Yuc116oJko/LWFCAbY JhUuGtcVARmsdwiGMfJuNCYyYpskKX8Pq4vvfmtRL/JDD3ZvDUJ9wOTLVoGG3vD7AQ9Y sGSkIQqIfVQz0wB/S7VAGIR+58i9tdZv9rdajIvdU/pC2vTcGppAV/VHRYFdlWIlswcj 41Rg== X-Gm-Message-State: AG10YOSamVceMAm4Pd2QJA6jEHMbnMRXQJ74eK4pbe2PRl6IbT9JMPBeSYBKPGCal32Zp8iEYm08a2pIIRjTNg== X-Received: by 10.28.32.206 with SMTP id g197mr10986275wmg.28.1454319697398; Mon, 01 Feb 2016 01:41:37 -0800 (PST) MIME-Version: 1.0 Sender: julienpauli@gmail.com Received: by 10.194.80.42 with HTTP; Mon, 1 Feb 2016 01:40:57 -0800 (PST) In-Reply-To: <56AE8735.4070901@gmail.com> References: <56A3A01F.1020500@php.net> <56AE8735.4070901@gmail.com> Date: Mon, 1 Feb 2016 10:40:57 +0100 X-Google-Sender-Auth: ODUiQFwayRC0HWBGrY0OpT9BaDo Message-ID: To: Stanislav Malyshev Cc: Nikita Popov , Internals Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] [RFC] Generalize support of negative string offsets From: jpauli@php.net (Julien Pauli) On Sun, Jan 31, 2016 at 11:14 PM, Stanislav Malyshev wrote: > Hi! > >> The only concern I have is that support of negative indexing will break >> symmetry with (proper) arrays, where we cannot support negative indexing. > > I think that was the main source of objections to this proposal in the > past. However, as one might say, string offsets are already not > symmetrical to array offsets - e.g. you can do $array["foo"] but not > $string["foo"]. > >> However this is unlikely to be a significant issue. (I do however play with >> the thought of reutilizing the obsolete {} indexing syntax to act as offset >> indexing instead.) > > I think it may be a good idea to start recommending using {} for string > offsets and [] for arrays. While both syntaxes may work for strings, the > intent (and expected handling of negatives, in this case) is much > clearer when different syntax is used. I totally agree here, having 2 different syntaxes for 2 different ways of using the array for strings is pretty nice. Julien