>> The "alternate syntax" with the colons is passe -- I think
>> you'd have to dig
>> pretty deep to find a script old enough that uses it for
>> anything other than
>> demonstration purposes. (Rasmus?)
>
>What utter tosh! *All* my scripts use the "alternative" syntax, as I think
>braces are an eyesore and an abomination, and cause more problems than they
>solve.
I apologize profusely to the fans of the "alternative syntax" who are still
using it.
I personally find the endxxx; to be more of an eyesore, but that's a
religious argument. :-)
>I've pretty much lost count of the number of times I've seen code written
>like this:
>
> if (x) {
> while (y) {
> ...
> } // end while
> ...
> } // end if
Never in my code.
If you can't tell from the logic structure of the code what } matches what
{, you're in trouble from the get-go. :-)
>Another advantage to the alternative syntax is that it can improve error
>reporting (slightly). Consider the following:
>PHP will tell you you have a syntax error on the very last line of your
>file, and you have no option but to go back and laboriously hand match all
>of your braces -- and with each ellipsis representing maybe tens (or even
>hundreds!)
Don't be ridiculous. Any decent editor will tell you where the missing { or
} is. No need to search for it by hand.
Not to mention that if you've indented properly, it's trivial to find it,
even in something as ill-suitable for Programming as NotePad.
>Now PHP will throw an error at the endwhile, because it knows there's an
>endfor missing -- and you've already cut out a large chunk of your code to
>check; better yet, as you're checking you can see at a glance what each
>"end" should be matching. And every "end" has to be there, too -- no
>cursing yourself for that lazy day when you left out a few comments on some
>"unimportant" closing braces!
None of my closing braces have comments. I never have a problem with
"missing" ones.
YMMV.
--
Like Music? http://l-i-e.com/artists.htm
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php