Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:20103 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 9150 invoked by uid 1010); 17 Nov 2005 21:42:32 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 9135 invoked from network); 17 Nov 2005 21:42:32 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Nov 2005 21:42:32 -0000 X-Host-Fingerprint: 204.11.219.139 lerdorf.com Linux 2.4/2.6 Received: from ([204.11.219.139:51027] helo=colo.lerdorf.com) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id 51/72-07637-849FC734 for ; Thu, 17 Nov 2005 16:42:32 -0500 Received: from [207.126.233.18] (rasmus2.corp.yahoo.com [207.126.233.18]) (authenticated bits=0) by colo.lerdorf.com (8.13.5/8.13.5/Debian-3) with ESMTP id jAHLgSYj000325 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Thu, 17 Nov 2005 13:42:28 -0800 Message-ID: <437CF943.7090800@lerdorf.com> Date: Thu, 17 Nov 2005 13:42:27 -0800 User-Agent: Thunderbird 1.5 (Macintosh/20051025) MIME-Version: 1.0 To: Andreas Korthaus CC: internals@lists.php.net, Ilia Alshanetsky References: <437B530A.5050105@prohost.org> <437CF6B4.5080207@web.de> In-Reply-To: <437CF6B4.5080207@web.de> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] dropping curly braces From: rasmus@lerdorf.com (Rasmus Lerdorf) Andreas Korthaus wrote: > Can someone tell me the reason for this decision? Very few people converted to using {} so the argument about reading old code doesn't really hold. If you go and grep through all the public code out there, pretty much none of it uses {} for character offsets. And internally there is absolutely no difference between {} and []. Having two syntaxes for the same thing makes no sense, and getting rid of [] would break all sorts of stuff. The original reason for the {} was a technical one to simplify the parser, but the landscape has changed and that reason no longer exists. As far a code readability and obviousness goes, I doubt anybody would guess their way to the $str{5} syntax. If you were new to PHP and you were going to try to guess how you would get a character offset in a string, what would your first guess be? Most non-PHP people I have asked have answered []. Removing the obvious syntax just doesn't make any sense. The other place {} is used outside of control blocks is in quoted strings where "{$foo{1}}" is much uglier than "{$foo[1]}". -Rasmus