Re: - True Annotations

From: Date: Wed, 09 Jan 2013 16:20:52 +0000
Subject: Re: - True Annotations
References: 1 2 3 4 5 6  Groups: php.internals 
Request: Send a blank email to internals+get-64754@lists.php.net to get a copy of this message
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

« previous php.internals (#64754) next »