guilhermebla...@gmail.com wrote on 26/11/2015 01:13:
Ok, so I'll explain why it's not "the same way" as you imagine.
I've heard this many times already so I'll save you keystrokes.
- "Sure, we can do that on docblocks"
- "Based on that, it doesn't need to be part of core and can safely be
implemented as a PECL extension"
OK, as far as everything I was talking about, this is all rather a straw
man, but perhaps that's just a miscommunication on my part, so let me
clear that up:
I have never suggested, and would not support a suggestion, that this be
implemented as an extension. I can absolutely see the advantage to
having a first-class syntax, baked into the main parser.
With that out of the way, we are back to the main point I was trying to
make which is that that syntax could, if we wanted, live inside the
context of /** */ blocks, which are already treated differently from
comments. The parsing problems within that context are very similar to
the parsing problems in any other context (again, assuming that this is
being implemented directly in the core parser, not in any kind of
extension).
So, the pros and cons of that are not to do with the parsing but to do with:
- potential compatibility with existing code, which may be tricky as
there is no standard to base the feature on
- the ability to polyfill code in older PHP versions, which is useful
but not something we have aimed for with previous features
- on the other side, the perception that docblocks are "just comments",
which would be hard to dispel even if we renamed them "metadata blocks"
Anyway, I apologise for drawing out this part of the discussion for so
long. I actually think it's just one of many decisions that needs making
before this feature can be attempted, probably starting with just what
an annotation consists of - is it a label with some text attached? a
resolved class name with parsed PHP code passed to its constructor (some
people have mentioned arrays and heredocs as parameters to annotations)?
somewhere between the two?
Regards,
--
Rowan Collins
[IMSoP]
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php