On 11/25/15 10:47 AM, Rowan Collins wrote:
Larry Garfield wrote on 25/11/2015 16:42:
However, doing so would make static checking more difficult; If annotations become a language-native feature, they should be a first-class citizen to make it easier for IDEs to handle.

Could you explain why docblocks are harder to parse than text outside docblocks? As far as I know, IDEs *already* parse docblocks, e.g. using @param and @return for type analysis, so I don't really see why generalising that would be a big problem.

Not being an IDE author I cannot say for certain, so perhaps it's easier than I imagine. However, speaking as a user I would want a robust level of static syntax validation of my annotations. Having robust syntax validation show up in *some* parts of my docblock but not others is confusing for me as a user; I hypothesize that it would similarly be more difficult to selectively treat bits and pieces of the docblock as code but not others. (My current IDE, PHPStorm, parses a docblock to validate that it matches the method signature but all it does is tell me if the whole thing is valid or not, and if I'm using a "used" class name. It's actually very unhelpful when dealing with complex Doctrine annotations like Drupal uses.)

Too, it means that a given annotation directive may have spurious * characters inside its string, if it's multi-line. Sure, that can be filtered out (Doctrine already does), but that's one more complication to have to consider.

For me, the "sometimes it's code and sometimes it's not, even though it looks the same" argument is sufficient to reject docblocks as a location for annotations.

--
--Larry Garfield


--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to