Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:38220 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 53580 invoked from network); 14 Jun 2008 16:14:56 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 14 Jun 2008 16:14:56 -0000 Authentication-Results: pb1.pair.com smtp.mail=chrisstocktonaz@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=chrisstocktonaz@gmail.com; sender-id=pass; domainkeys=bad Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.200.174 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: chrisstocktonaz@gmail.com X-Host-Fingerprint: 209.85.200.174 wf-out-1314.google.com Received: from [209.85.200.174] ([209.85.200.174:28892] helo=wf-out-1314.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 53/D8-06776-F7EE3584 for ; Sat, 14 Jun 2008 12:14:56 -0400 Received: by wf-out-1314.google.com with SMTP id 26so4436817wfd.26 for ; Sat, 14 Jun 2008 09:14:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:cc:in-reply-to:mime-version:content-type:references; bh=fRkj73GUrdz4GULGuuJi1H4I22tx5V9+9hXpTYE3iMw=; b=txBfvQ4exMdbFhP2in58lJ/bHgSolzfcLrdU2WJplhgVC6xhbmN/4HB3EFKAjr/uBh CwXZFbJDrcFGGM1FaVaSHEemZOa5R1Nn6xKJ4JD9wLlOLlXHGpr1ZEFbzQWkjUblO5gX T5dYw79f+jDAJPC8E2WrCcMRkKXWK6yb0klko= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version :content-type:references; b=SACtWEqAsxjmdgjzBEZNVjRTd3aEXzUDeChfdcc46Xplx8d+KDEN/CPCMomrEILnfA 6+ysK1NoFoJtZhHPXLTDHlAX6xrVZHkikfrMWpstDLGiksjEldEGLrtuMb2yqkTVLBLb e35c2dcAVp6u74vZyIveYn45FB4/ERYRQF4pw= Received: by 10.142.215.5 with SMTP id n5mr1622587wfg.27.1213460093128; Sat, 14 Jun 2008 09:14:53 -0700 (PDT) Received: by 10.142.230.16 with HTTP; Sat, 14 Jun 2008 09:14:53 -0700 (PDT) Message-ID: Date: Sat, 14 Jun 2008 09:14:53 -0700 To: "Andi Gutmans" Cc: "Lars Strojny" , "Markus Fischer" , "PHP Developers Mailing List" In-Reply-To: <698DE66518E7CA45812BD18E807866CE01AB3D1D@us-ex1.zend.net> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_13298_24474832.1213460093140" References: <77972256-ED0C-4FCE-8DEF-8283FE1BBFC5@roshambo.org> <484F0897.4040405@fischer.name> <1213139582.12765.5.camel@localhost> <698DE66518E7CA45812BD18E807866CE01AB3D1D@us-ex1.zend.net> Subject: Re: [PHP-DEV] deprecation status of $str{42} versus $str[42] From: chrisstocktonaz@gmail.com ("Chris Stockton") ------=_Part_13298_24474832.1213460093140 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Hello, On Tue, Jun 10, 2008 at 9:11 PM, Andi Gutmans wrote: > Hi, > > $str{} was considered a best practice for a while so as you can see via > Google Code Search it's been used quite a bit. > I take the blame for introducing it with the intention to not only > create a better separation between arrays and string offsets but by also > then allowing for a cleaner implementation for string offsets. > Unfortunately I never delivered that cleaner implementation esp. as > there didn't seem a huge benefit > > I don't have strong feelings either way esp. as moving from $str{} to > $str[] is scriptable but given that so many people have used it and > there are benefits to separating the two (it also resolves an ambiguity) > I'd like to put another option out there which is to try and see if we > can actually follow through on original intentions of also delivering > technical benefit in addition to the syntax separation. I personally have always used {} for string offsets because it just felt right. [] seems like it is for arrays, for me, using it on strings makes me feel dirty. Could we maybe visit some of the ideas you have had with {} syntax offering some benefit? That I do not completely understand and would be nice to know what you mean. Maybe something like built in substr? since it wouldn't break existing use of {}, tough thing is the ambiguity between {1} regular and {1} substr, dunno: $str = "abcdef"; $result = $str{1}; // returns b, but substr would be something like bcdef $result = $str{1, 2} // returns bc, this we know what to return for sure $result = $str{1,} // maybe to make up for lack of {1} returning remaining portion, its a little ugly almost feels like a syntax error Just trying to figure out how you could have technical benefit with it, maybe you just meant performance optimization or something. -Chris ------=_Part_13298_24474832.1213460093140--