Re: dropping curly braces

From: Date: Fri, 18 Nov 2005 11:36:11 +0000
Subject: Re: dropping curly braces
References: 1 2 3 4 5  Groups: php.internals 
Request: Send a blank email to internals+get-20139@lists.php.net to get a copy of this message
Derick Rethans wrote:
That's the problem - also grep does not know if [] is used for arrays or stings. That's the same for programmers, it's often not easy to conclude from context - that's my point.
grep won't, but php -l will.
That's true. But what about "reducing complexity"? Don't you think it's useful to allow a convention like {} for strings and [] for arrays, so you can be sure what $str{1} means without looking at any context? As Rasmus explained, this can't be enforced, but you still can use a convention in your projects today. I think it's good to increase readability using conventions like that. I'd not drop anything or break any BC, I'd keep this option because having such a convention is very useful when debugging/reading complex scripts. I know that it's not much work to replace {} with [] syntax, but this will decrease readability - that's my only problem. best regards Andreas

« previous php.internals (#20139) next »