Re: - True Annotations

From: Date: Wed, 09 Jan 2013 12:13:23 +0000
Subject: Re: - True Annotations
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to internals+get-64733@lists.php.net to get a copy of this message
On Wed, Jan 9, 2013 at 2:09 PM, Christian Kaps <christian.kaps@mohiva.com>wrote: > Am 09.01.2013 13:03, schrieb Yahav Gindi Bar: > >> On Wed, Jan 9, 2013 at 1:57 PM, Christian Kaps <christian.kaps@mohiva.com >> >**wrote: >> >> Hi, >>> >>> >>> I agree here, I think the above, if possible would be best. In my >>> >>>> mind annotations should proabably be limited in scope to class >>>> declarations and thus only before a class keyword, before a property >>>> or method declaration. >>>> >>>> In none of those scopes would [ ] be a parsing issue I believe... >>>> >>>> The one case would be at the beginning of a class, but if simply >>>> added something such as: >>>> [:SomeAttribute(xyz,abc),****SomeAttribute2] >>>> >>>> >>>> It could never be confused with short array syntax and is still brief. >>>> >>>> >>> I think when implementing real annotations, then it should be possible to >>> declare arrays in it. So I think the square brackets don't work. >>> [Foo([1,2,3])] >>> >>> Cheers, >>> Christian >>> >>> -- >>> PHP Internals - PHP Runtime Development Mailing List >>> To unsubscribe, visit: http://www.php.net/unsub.php >>> >>> But the colon prefix won't cover this case? >>> >> >> You can, as I've mentioned in my post at the doc-block parser discussion, >> use a keyword inside the brackets to symbolize annotation, for example >> >> [metadata: Key] >> [metadata: MaxLength(10)] >> [metadata: Relations(["foo", "bar", "baz"])] >> public $id; >> > > Then rather [@Foo([1,2,3])] if it's possible! > > > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > Yeah, that's cool. To be honest, I took that idea from C# which has, for example (Quoted from standard template AssemblyInfo.cs): // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]

« previous php.internals (#64733) next »