On 1/9/13 9:31 AM, Levi Morrison wrote:
they are nearly syntactically identical to executable code.
"nearly" is the keyword there. They lack the ending semi-colon. Sure,
this might mean PHP has to actually use an abstract syntax tree, but
that's long overdue in my opinion. I know others disagree. This is
only tangentially related, so I won't say more.
Even if the parser is adjusted to cope with that, it's still an
extremely subtle difference for developers to keep track of. Consider
the following procedural snippets:
@Foo[narf]
function something($narf) {}
@Foo[narf];
function something($narf) {}
The first one says that $narf should pass @Foo validation.
The second one says to call the function Foo with the string constant
"narf", and then define a function called something().
That's the sort of subtle bug that's just begging for someone to make an
honest typo and spend the next 6 hours tracking it down, until he
realizes what he did and proceeds to bang his head against his desk in
frustration for missing such a "simple" error.
Let's not subsidize the headache drug manufacturers with PHP syntax
decisions. :-)
--Larry Garfield
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php