The implementation is not going to be simple, and taking in account other
tasks, it may be difficult to provide high-quality implementation. Lets
look if it's really a desirable feature. Then I may do all my best, or
forget about it by 7.1.

Thanks. Dmitry.

On Mon, Feb 16, 2015 at 3:14 PM, Nikita Popov <nikita....@gmail.com> wrote:

> On Mon, Feb 16, 2015 at 12:07 PM, Dmitry Stogov <dmi...@zend.com> wrote:
>
>> hi,
>>
>> During discussion of different ways of implementing "Design by Contract"
>> we got an idea of using annotations.
>>
>> BTW: annotations are useful by their own and may be used for different
>> purposes. Support for annotations was proposed long time ago:
>>
>> https://wiki.php.net/rfc/annotations
>> https://wiki.php.net/rfc/annotations-in-docblock
>> https://wiki.php.net/rfc/reflection_doccomment_annotations
>>
>> HHVM already implemented similar concept
>>
>> http://docs.hhvm.com/manual/en/hack.attributes.php
>>
>> I made a quick and dirty PoC that shows how we may implement annotations
>> in PHP7 and how powerful they may be :
>> https://gist.github.com/dstogov/dbf2a8f46e43719bd2c2
>>
>> The test there is self explainable. Of course, annotations just provide a
>> way to add metadata, but doesn't define attribute names or the ways they
>> are going to be used. Only Reflection API to read.
>>
>> There are still a lot of technical problems that have to be solved.
>> Right now, we just need to answer a question - if we like this in PHP7?
>> Thought and opinions are welcome...
>>
>> Thanks. Dmitry.
>>
>
> Hi Dmitry!
>
> I think this is a great idea, but we should postpone it to PHP 7.1.
> Especially if you want to make this AST based (which would require both
> stabilizing the AST we return for expressions and having APIs to do codegen
> based on the AST) it will require a lot of work both for design and
> implementation. I don't think it's realistic to include a high-quality
> implementation in PHP 7.
>
> As this does not have any BC concerns that I can see, I think it would be
> safer to move this to PHP 7.1, when we will have more time to carefully
> design this.
>
> Nikita
>
>

Reply via email to