Re: - True Annotations

From: Date: Wed, 09 Jan 2013 16:29:52 +0000
Subject: Re: - True Annotations
References: 1 2 3 4 5 6 7  Groups: php.internals 
Request: Send a blank email to internals+get-64757@lists.php.net to get a copy of this message
On Wed, Jan 9, 2013 at 5:20 PM, Larry Garfield <larry@garfieldtech.com>wrote: > 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 > > I agree with the risks here. But i also really prefer a Token: <content> approach then a [open token] <content> [close token] approach Can we use a combination? like: @annot: Foo[narf] -- Rafael Dohms PHP Evangelist and Community Leader http://doh.ms http://wwwamsterdamphp.nl

« previous php.internals (#64757) next »