Re: Annotations in PHP7
| From: | Derick Rethans | Date: | Wed, 18 Feb 2015 08:59:37 +0000 |
| Subject: | Re: Annotations in PHP7 | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-83034@lists.php.net to get a copy of this message | ||
On Tue, 17 Feb 2015, Dmitry Stogov wrote:
> On Mon, Feb 16, 2015 at 10:57 PM, Derick Rethans <derick@php.net> wrote:
>
> > On Mon, 16 Feb 2015, Dmitry Stogov 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
> > > ÿùè…H‰
> > > ?YÚ„€|thttps://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
> >
> > Why didn't you pick the same syntax as hack?
>
> It's not smart enough to be used for DbC, AOT and many other features (we
> are going to capture AST).
I realize that, but:
<optimization_level(2)>
could easily look like:
<<optimization_level(2)>>
The latter syntax <<…>> is what Hack does, but you picked <…> - which
makes it both the same as HTML/XML tags *and* different from Hack. The
<…> syntax also gets in the way of XHP
(https://github.com/facebookarchive/xhp-php5-extension)
cheers,
Derick