On Mon, Feb 16, 2015 at 3:07 AM, Dmitry Stogov <dmi...@zend.com> wrote:
> hi,
>
> During discussion of different ways of implementing "Design by Contract" we
> got an idea of using annotations.

Thanks a lot to push that forward!

> 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...

Is it the branch/fork available?

I think the best way to validate a soluton (and its specs) is to try
to port existing annotations needs using this syntax (like Doctrine's
one). Even if the syntax is different, it will show if the syntax is
powerful enough to cover what is already used. I am not saying we need
to support everything but only what is necessary to actually implement
existing annotations (which have been used for quite some time and
proven to be very useful) using this syntax.

I would also leave the docblock/comments idea out of the discussions,
it is really not what annotations are. If we can spare us that part of
the debate, we can focus on the actual specs and implementations. :)

Cheers,
-- 
Pierre

@pierrejoye | http://www.libgd.org

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

Reply via email to