Re: Annotation PHP 7
| From: | Andrea Faulds | Date: | Tue, 04 Nov 2014 22:20:12 +0000 |
| Subject: | Re: Annotation PHP 7 | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-78688@lists.php.net to get a copy of this message | ||
> On 4 Nov 2014, at 21:31, Stas Malyshev <smalyshev@sugarcrm.com> wrote:
>
>> This brings the next piece of the puzzle. We have to update lexical and
>> semantical understanding of PHP. Taking Java's approach (@) does not
>> work in PHP, because it conflicts with error supression. Same thing
>
> Except for the mental context, how @ conflicts with errors? Suppression
> is always in runtime context and applied to expressions, annotations are
> always outside of it and apply to declarations. Unless of course you
> want to annotate variables and closures, but I'm not sure annotating
> expressions is such a good idea anyway
At the top-level, @ is a shift/reduce conflict due to ambiguity between statement annotation and
expression.
Though it might be possible to work around that with the AST (ew).
--
Andrea Faulds
http://ajf.me/