Re: Annotation PHP 7
| From: | Lester Caine | Date: | Tue, 04 Nov 2014 21:42:12 +0000 |
| Subject: | Re: Annotation PHP 7 | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-78687@lists.php.net to get a copy of this message | ||
On 04/11/14 21:24, Sebastian B.-Hagensen wrote:
> Just as a note: /** and /* are already treated differently by the
> parser (T_DOC_COMMENT vs. T_COMMENT, this difference is also present
> in opcache).
>
> Anyway, metadata/annotations/whatever you want to call them should be
> seperated from comments and verbal descriptions on a
> syntax level, not just by some conventions. It's one of the big
> advantages of having them in the core. If your project needs to
> support php5 you can still use doc-comments to store such data, even
> if php7 gets first class annotations you may still parse the comment
> in whichever way you want. By having a native way of defining them,
> php would also avoid all possiblities of bc-breaks in libraries
> consuming doc-comments.
I take your point, except the bulk of my code already has this metadata
using the current format. I either have to reformat it to some new
'php7' format ( but that will mess up php5 anyway? ), or I just carry on
using the php5 format to avoid having code which is problematic IN php5?
php5 needs this wrapped in comment blocks to hid it for BC reasons?
> 2014-11-04 22:11 GMT+01:00 Lester Caine <lester@lsces.co.uk>:
>> On 04/11/14 20:18, guilhermeblanco@gmail.com wrote:
>>> Primarily, I do not see docblocks as the right place to store class'
>>> metadata information. Metadata != Comments.
>>
>> We use comment wrappers in many places to hide secondary material from
>> other processes. Just rename docblocks -> metadata ... what is the
>> problem? Now expand the docblock key words and one does not have to
>> worry about clashes as it's all ring fenced.
>>
>> Is the material needed at runtime? In which case 'minimize' can strip it
>> all. I can even see a case for /** being treated differently to /* and
>> // blocks if needs be.
--
Lester Caine - G8HFL
-----------------------------
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk
Rainbow Digital Media - http://rainbowdigitalmedia.co.uk