On 5/6/2016 8:02 AM, Dmitry Stogov wrote: > On 05/06/2016 05:06 AM, Jesse Schalken wrote: >> If you're going to say "do what you want" with regards to annotations, >> then >> just let them be a text string. Parsing the annotation as PHP but not >> evaluating it as PHP seems a very strange and arbitrary half-way >> point. If >> the thing consuming the AST is expected to eval() it, then why didn't PHP >> do that already? If the thing consuming the AST is expected not to eval() >> it, then it must effectively implement it's own language sharing PHP's >> syntax but not PHP's semantics. Since it can't possibly attach meaning to >> all of PHP's syntax, PHP will enforce that the string is valid PHP even >> though the annotation language will be a very small subset. Not only does >> that buy you very little in terms of validity checking, but it constrains >> the annotation language to be a subset of PHP's syntax even when such a >> constraint may be entirely inappropriate. >> >> A true "do what you want" approach, if that is the right approach, >> would be >> for the annotation body to be a free text string. > > You talk about a subset of the proposed RFC. > It proposes an additional question about AST usage. >
I think he is talking exactly about the proposed RFC, it is completely arbitrary and will lead to much confusion and it is not anymore useful than the current PhpDoc approach that we have in userland. Having an attribute grammar [1] adds overhead to PHP while parsing our files and removes only the regular expression stuff that is currently implemented in the annotation systems of all the software out there; which is at least offline. I do not see a single benefit in the current feature proposal. Especially since one can already run the content of a PhpDoc tag through the AST thingy and *bam* you have exactly the same thing. What we need is an annotation system that works for userland and not this attribute grammar crutch just because it is easier to come up with and agree upon. [1] https://en.wikipedia.org/wiki/Attribute_grammar -- Richard "Fleshgrinder" Fussenegger
signature.asc
Description: OpenPGP digital signature