[dev] Fwd: Re: [PHP-DEV] dropping curly braces

Matt Selsky selsky at columbia.edu
Fri Nov 18 08:31:21 PST 2005


I think we use {} for character offsets in about 45 places if this 
regular expression does the job.

egrep -r '\$[A-Za-z][A-Za-z0-9]*{[0-9]+}' .

On Thu, Nov 17, 2005 at 04:46:07PM -0500, Chuck Hagenbuch wrote:
> FYI. Someone want to start grepping?
> 
> ----- Forwarded message from rasmus at lerdorf.com -----
>      Date: Thu, 17 Nov 2005 13:42:27 -0800
>      From: Rasmus Lerdorf <rasmus at lerdorf.com>
> Reply-To: Rasmus Lerdorf <rasmus at lerdorf.com>
>   Subject: Re: [PHP-DEV] dropping curly braces
>        To: Andreas Korthaus <akorthaus at web.de>
>        Cc: internals at lists.php.net, Ilia Alshanetsky <ilia at prohost.org>
> 
> 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
> 
> -- 
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 
> ----- End forwarded message -----
> 
> 
> -chuck
> 
> -- 
> "But she goes not abroad in search of monsters to destroy." - John 
> Quincy Adams
> 
> -- 
> Horde developers mailing list - Join the hunt: http://horde.org/bounties/
> Frequently Asked Questions: http://horde.org/faq/
> To unsubscribe, mail: dev-unsubscribe at lists.horde.org


More information about the dev mailing list