Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:20159 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 44170 invoked by uid 1010); 18 Nov 2005 15:41:40 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 44155 invoked from network); 18 Nov 2005 15:41:40 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 18 Nov 2005 15:41:40 -0000 X-Host-Fingerprint: 217.160.230.41 mout.perfora.net Received: from ([217.160.230.41:57258] helo=mout.perfora.net) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id DB/9A-07637-336FD734 for ; Fri, 18 Nov 2005 10:41:39 -0500 Received: from [146.203.104.50] (helo=MobileZ) by mrelay.perfora.net (node=mrelayus1) with ESMTP (Nemesis), id 0MKp2t-1Ed8Mk3jTQ-0003mJ; Fri, 18 Nov 2005 10:41:33 -0500 To: "'Ford, Mike'" , Date: Fri, 18 Nov 2005 10:41:31 -0500 Organization: New York PHP Message-ID: <002f01c5ec56$8e0b3950$3268cb92@MobileZ> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 11 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2670 Thread-Index: AcXrwFoG7yMTmnJfRvCeON/O4IaG0gAfK+ZQAAGXPNA= In-Reply-To: X-Provags-ID: perfora.net abuse@perfora.net login:424ef50049a733f639bdf6b6cf560c3a Subject: RE: [PHP-DEV] dropping curly braces From: lists@zaunere.com ("Hans Zaunere") References: Ford, Mike wrote on Friday, November 18, 2005 7:58 AM: > On 17 November 2005 21:42, Rasmus Lerdorf wrote: > > > 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 []. And most public code still uses hacks for register_globals, is insecure and poorly written. > So all of those who belived the "[] for string access is deprecated" > line (or simply prefer the visual differentiation) and have 10s of > thousands of lines of code with liberal use of $string{} are going to > have to spend ages fixing that up? Sounds like they got us good! No more listening to documentation for us... > > Having two syntaxes for the same thing makes no sense, And neither does arbitrarily removing one syntax; especially when that syntax has been the recommended way of referencing characters in strings for years. > I don't buy this -- having two ways of doing certain things is one > feature that makes PHP so great -- it increases the user base who > find it easy to use, as they can pick the method that makes most > sense to them. I love the {} syntax, so let me use it. You don't -- > fine, don't use it. (I won't convert to [] -- I'll go for > substr(..,..,1) instead). Another example: I hate proliferating {} > for control structures and use exclusively the if (): ... endif; form > -- fine, let me use it; your preference may be otherwise, but that's > fine too. In the end, each of us gets the PHP syntax we find easiest > to use, without denying the other his preference. What's so wrong > with that? And with so much work to maintain backwards compatibility in the past, why do we need this change now? While we're changing things, let's standardize function parameter ordering. > > 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? > > Well, it wouldn't be [] because I'd guess that's for array access as > in other languages. I probably wouldn't guess at all, but look it > up, and be very happy to find it was {}. I remember being very, very > surprised to find [] doing double duty, and glad that {} existed as > an alternative. Yup - if anything, let's remove [] as string access - then again, if it ain't broke, why try to fix it? --- Hans Zaunere / President / New York PHP www.nyphp.org / www.nyphp.com