Hi!

Ilia Alshanetsky wrote:
Once again, I encourage everyone to take the time to try out this RC and
test it against your code or simply run "make test".

Works fine for me, but I've a question about the dropped curly braces.
Has there been some public discussion about it recently? I'm sorry if I have missed it.

Why have curly braces for strings been dropped? Even apart from the fact that the manual states "array-brackets syntax is deprecated as of PHP 4" and AFAIK most people are fine with using curly braces in their scripts for many years now - what's the idea behind that change?

I think scripts will become more difficult to read, to understand and to debug.

e.g. think of something like:

$var = myFunction();
// a lot of code

$var[2] = MY_CONSTANT;
// a lot of code

switch ($var[1]) {
  // [...]
}

You loose the information whether $var is a string or an array (if only curly braces were used for strings). That's not a very good example, but I looked at the phpt tests failing because of the Notice: IMO these simple files became harder to understand by removing the curly braces. And if you think of more complex scripts, where the variable initialisation is far away from the code you try to debug... it makes it unecessarily hard to understand the code. And don't forget that you "waste" more time with reading/understanding old code or code written by someone else, than writing new code!

Perhaps it's no problem for people coming from C programming which are probably used to char arrays..., but I'm quite sure that it is more difficult to learn/understand and USE/READ(!) for the average PHP programmer. IMO it's very useful to have not the same syntax for arrays and strings.

Can someone tell me the reason for this decision?


best regards
Andreas

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to