Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:62663 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 41241 invoked from network); 2 Sep 2012 09:06:32 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 2 Sep 2012 09:06:32 -0000 Authentication-Results: pb1.pair.com smtp.mail=smalyshev@sugarcrm.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=smalyshev@sugarcrm.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain sugarcrm.com designates 67.192.241.143 as permitted sender) X-PHP-List-Original-Sender: smalyshev@sugarcrm.com X-Host-Fingerprint: 67.192.241.143 smtp143.dfw.emailsrvr.com Linux 2.6 Received: from [67.192.241.143] ([67.192.241.143:56484] helo=smtp143.dfw.emailsrvr.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id F6/45-17065-39123405 for ; Sun, 02 Sep 2012 05:06:29 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp4.relay.dfw1a.emailsrvr.com (SMTP Server) with ESMTP id 49D873A0272; Sun, 2 Sep 2012 05:06:25 -0400 (EDT) X-Virus-Scanned: OK Received: by smtp4.relay.dfw1a.emailsrvr.com (Authenticated sender: smalyshev-AT-sugarcrm.com) with ESMTPSA id A66E03A0297; Sun, 2 Sep 2012 05:06:24 -0400 (EDT) Message-ID: <5043218F.2060503@sugarcrm.com> Date: Sun, 02 Sep 2012 02:06:23 -0700 Organization: SugarCRM User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:15.0) Gecko/20120824 Thunderbird/15.0 MIME-Version: 1.0 To: Lester Caine CC: "internals@lists.php.net" References: <13095916.1346546580825.JavaMail.root@wamui-haziran.atl.sa.earthlink.net> <5042B7F5.7030409@sugarcrm.com> <50431837.7060106@lsces.co.uk> In-Reply-To: <50431837.7060106@lsces.co.uk> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Re: Support negative indexes for arrays and strings From: smalyshev@sugarcrm.com (Stas Malyshev) Hi! > Stanislav I though that the discussion on adding this type of functionality to > strings was already a done deal? Despite the obvious problems it introduces. I'm not sure what you mean by "done deal". There was this RFC: https://wiki.php.net/rfc/strncmpnegativelen but that wasn't implemented due to some objections. There's also a pull about negative strings offset but no RFC and no vote was ever held on it. > I've already pointed out why there is no way that this can be discussed in > connection with 'collection arrays' and so there does need to be a clean break > between the two for ANY discussion. I believe that PHP is the only language that > allows us to use -ve indices ( i.e. keys ) in arrays? That was one of the nice Depending what you mean by "arrays". I'm sure any language that has maps indexed by value would not exclude values equaling to negative numbers. E.g. in python: >>> a = {} >>> a[-2] = 1 >>> a {-2: 1} I'm not sure we need or can do anything else for arrays. We maybe could for strings, technically, though I'm not currently convinced that having substr() we really need to. But if the vote goes other way, for strings I think it may be OK, if we figure out what to do with out-of-the-string offsets. -- Stanislav Malyshev, Software Architect SugarCRM: http://www.sugarcrm.com/ (408)454-6900 ext. 227