[PHP-DEV] Native Annotation Syntax

2015-11-24 Thread Pedro Cordeiro
Hello. I'd been reading some old RFCs recently, and I found two RFCs on the subject of annotations, both by Guilherme Blanco. The first one, which proposed a native syntax for annotations, is marked as 'declined', and I couldn't find a discussion for it anywhere. The second one, which proposes ret

Re: [PHP-DEV] Native Annotation Syntax

2015-11-24 Thread Benjamin Eberlei
On Tue, Nov 24, 2015 at 5:30 PM, Pedro Cordeiro wrote: > Hello. > > I'd been reading some old RFCs recently, and I found two RFCs on the > subject of annotations, both by Guilherme Blanco. The first one, which > proposed a native syntax for annotations, is marked as 'declined', and I > couldn't f

Re: [PHP-DEV] Native Annotation Syntax

2015-11-24 Thread Rowan Collins
On 24/11/2015 16:30, Pedro Cordeiro wrote: I'd been reading some old RFCs recently, and I found two RFCs on the subject of annotations, both by Guilherme Blanco. The first one, which proposed a native syntax for annotations, is marked as 'declined', and I couldn't find a discussion for it anywher

Re: [PHP-DEV] Native Annotation Syntax

2015-11-24 Thread Sara Golemon
On Tue, Nov 24, 2015 at 11:05 AM, Rowan Collins wrote: > At first sight, these seem like details which could be tweaked later, but > they make a difference to what syntax to standardise: is the annotation name > just a string, or a valid class name? is the value of the annotation just a > string,

Re: [PHP-DEV] Native Annotation Syntax

2015-11-25 Thread Pedro Cordeiro
I'd really like to see something outside the docblock. Comment annotations are a workaround for the lack of native annotations. It makes the environment hard to learn ("What does @param do? And what does @ManyToMany do?"), it makes it impossible for IDEs to hint/autocomplete without project-specifi

Re: [PHP-DEV] Native Annotation Syntax

2015-11-25 Thread Lester Caine
On 25/11/15 11:04, Pedro Cordeiro wrote: > I feel like this is a major feature that's missing, and people are using it > in a suboptimal way (docblocks), so I thought I'd reopen the discussion and > see if someone more familiar with the internals feels like implementing it In previous discussions

Re: [PHP-DEV] Native Annotation Syntax

2015-11-25 Thread Pedro Cordeiro
2015-11-25 13:47 GMT-02:00 Lester Caine : > Any new system would require > every third party tool to be adapted to use it > That's not true at all. A new syntax would in no way invalidate parsing annotations from docblocks. The only legacy code that is supported by IDEs (if they are, PHPStorm wi

Re: [PHP-DEV] Native Annotation Syntax

2015-11-25 Thread Larry Garfield
On 11/25/15 10:31 AM, Pedro Cordeiro wrote: 2015-11-25 13:47 GMT-02:00 Lester Caine : Any new system would require every third party tool to be adapted to use it That's not true at all. A new syntax would in no way invalidate parsing annotations from docblocks. The only legacy code that is s

Re: [PHP-DEV] Native Annotation Syntax

2015-11-25 Thread Rowan Collins
Larry Garfield wrote on 25/11/2015 16:42: However, doing so would make static checking more difficult; If annotations become a language-native feature, they should be a first-class citizen to make it easier for IDEs to handle. Could you explain why docblocks are harder to parse than text outs

Re: [PHP-DEV] Native Annotation Syntax

2015-11-25 Thread Pedro Cordeiro
Rowan, even if they are not harder, there is no reason to keep this feature in docblocks. Even the argument "compatibility with current implementations" is flawed, because there are many different implementations (not only doctrine's) with different syntaxes, so any native option would break SOME i

Re: [PHP-DEV] Native Annotation Syntax

2015-11-25 Thread Rowan Collins
Pedro Cordeiro wrote on 25/11/2015 11:04: I'd really like to see something outside the docblock. Comment annotations are a workaround for the lack of native annotations. This is true, but they are now a very widely used workaround, and any native support for them could be polyfilled using the

Re: [PHP-DEV] Native Annotation Syntax

2015-11-25 Thread Lester Caine
On 25/11/15 16:53, Rowan Collins wrote: > Now, if annotations were being implemented as something brand new to > PHP, like say Traits were, I'd agree that we should look to languages > like Java and C# for syntax ideas. But since a lot of people have > already invented annotations using docblocks,

Re: [PHP-DEV] Native Annotation Syntax

2015-11-25 Thread Rowan Collins
Pedro Cordeiro wrote on 25/11/2015 16:53: Rowan, even if they are not harder, there is no reason to keep this feature in docblocks. Well, I can think of one reason: backwards compatibility. I don't mean with current frameworks - as you say, these are not currently standardised, so some will n

Re: [PHP-DEV] Native Annotation Syntax

2015-11-25 Thread Larry Garfield
On 11/25/15 10:47 AM, Rowan Collins wrote: Larry Garfield wrote on 25/11/2015 16:42: However, doing so would make static checking more difficult; If annotations become a language-native feature, they should be a first-class citizen to make it easier for IDEs to handle. Could you explain why

Re: [PHP-DEV] Native Annotation Syntax

2015-11-25 Thread Rowan Collins
Larry Garfield wrote on 25/11/2015 17:06: Too, it means that a given annotation directive may have spurious * characters inside its string, if it's multi-line. Sure, that can be filtered out (Doctrine already does), but that's one more complication to have to consider. I would expect that b

Re: [PHP-DEV] Native Annotation Syntax

2015-11-25 Thread Rowan Collins
Pedro Cordeiro wrote on 25/11/2015 17:04: 2015-11-25 14:53 GMT-02:00 Rowan Collins >: If it helps, just think of /** ... */ as not being a comment, but already a first-class piece of syntax. Except that it won't parse some stuff while parsing some othe

Re: [PHP-DEV] Native Annotation Syntax

2015-11-25 Thread Rowan Collins
Larry Garfield wrote on 25/11/2015 17:06: For me, the "sometimes it's code and sometimes it's not, even though it looks the same" argument is sufficient to reject docblocks as a location for annotations. Annotations aren't code, they're metadata, and docblocks already contain metadata; it's

Re: [PHP-DEV] Native Annotation Syntax

2015-11-25 Thread guilhermebla...@gmail.com
Hi, I'm the co-author of RFC of Annotations, co-author of Annotations in docblock which I abandoned for being conceptually wrong and co-author of Doctrine Annotations. Comments such as the one from Lester Caine "In previous discussions it was pointed out that a substantial amount of legacy code a

Re: [PHP-DEV] Native Annotation Syntax

2015-11-25 Thread Larry Garfield
On 11/25/15 11:00 AM, Rowan Collins wrote: I don't feel that strongly in favour of docblocks, but I don't think the reasons given against are particularly strong. Regards, If you don't feel strongly in favor of them, why are you trying to make a case for them so strongly? Just for kicks? W

Re: [PHP-DEV] Native Annotation Syntax

2015-11-25 Thread Rowan Collins
Larry Garfield wrote on 25/11/2015 17:39: On 11/25/15 11:00 AM, Rowan Collins wrote: I don't feel that strongly in favour of docblocks, but I don't think the reasons given against are particularly strong. Regards, If you don't feel strongly in favor of them, why are you trying to make a cas

Re: [PHP-DEV] Native Annotation Syntax

2015-11-25 Thread guilhermebla...@gmail.com
I can give you a good argument. opcache.save_comments=0 Make it work. On Wed, Nov 25, 2015 at 12:48 PM, Rowan Collins wrote: > Larry Garfield wrote on 25/11/2015 17:39: > >> On 11/25/15 11:00 AM, Rowan Collins wrote: >> >>> I don't feel that strongly in favour of docblocks, but I don't think t

Re: [PHP-DEV] Native Annotation Syntax

2015-11-25 Thread Rowan Collins
guilhermebla...@gmail.com wrote on 25/11/2015 17:58: I can give you a good argument. opcache.save_comments=0 Make it work. Simple: remove that configuration variable, and always save doc blocks. As mentioned, my view would be that these should no longer be considered "comments", but "metada

Re: [PHP-DEV] Native Annotation Syntax

2015-11-25 Thread Pedro Cordeiro
On top of it, it'd break obfuscators like Zend Guard. 2015-11-25 15:58 GMT-02:00 guilhermebla...@gmail.com < guilhermebla...@gmail.com>: > I can give you a good argument. > > opcache.save_comments=0 > > Make it work. > > On Wed, Nov 25, 2015 at 12:48 PM, Rowan Collins > wrote: > > > Larry Garfie

Re: [PHP-DEV] Native Annotation Syntax

2015-11-25 Thread Rowan Collins
Rowan Collins wrote on 25/11/2015 18:47: Simple: remove that configuration variable, and always save doc blocks. Thinking about it, you don't even need to do that, just add a structure in the opcache memory layout for the parsed annotations, allowing you to accelerate access to those. (Someth

Re: [PHP-DEV] Native Annotation Syntax

2015-11-25 Thread guilhermebla...@gmail.com
Hi Rowan, If you're in a shared hosting, you can't "simply" remove the configuration variable. Relying on extensions or configuration flags to support core language features is very bad. We don't have flags that can turn IF support off for example, why we would have that for annotations? I can bri

Re: [PHP-DEV] Native Annotation Syntax

2015-11-25 Thread Larry Garfield
On 11/25/15 11:48 AM, Rowan Collins wrote: Larry Garfield wrote on 25/11/2015 17:39: On 11/25/15 11:00 AM, Rowan Collins wrote: I don't feel that strongly in favour of docblocks, but I don't think the reasons given against are particularly strong. Regards, If you don't feel strongly in favo

Re: [PHP-DEV] Native Annotation Syntax

2015-11-25 Thread guilhermebla...@gmail.com
Hi Rowan, I'm avoiding drilling down as much as I can to explain every single decision motivation of the 2010's patch, which hints every time why docblocks are bad. Maybe another example may help you to illustrate the problem; all I want is to add a multi-lined text in an annotation (using your do

Re: [PHP-DEV] Native Annotation Syntax

2015-11-25 Thread Rowan Collins
On 25 November 2015 19:02:37 GMT, "guilhermebla...@gmail.com" wrote: >Hi Rowan, > >If you're in a shared hosting, you can't "simply" remove the >configuration >variable. >Relying on extensions or configuration flags to support core language >features is very bad. We don't have flags that can turn

Re: [PHP-DEV] Native Annotation Syntax

2015-11-25 Thread guilhermebla...@gmail.com
Ok, so I'll explain why it's not "the same way" as you imagine. I've heard this many times already so I'll save you keystrokes. - "Sure, we can do that on docblocks" - "Based on that, it doesn't need to be part of core and can safely be implemented as a PECL extension" IMHO, internals need to sto

Re: [PHP-DEV] Native Annotation Syntax

2015-11-26 Thread Rowan Collins
guilhermebla...@gmail.com wrote on 26/11/2015 01:13: Ok, so I'll explain why it's not "the same way" as you imagine. I've heard this many times already so I'll save you keystrokes. - "Sure, we can do that on docblocks" - "Based on that, it doesn't need to be part of core and can safely be imple

Re: [PHP-DEV] Native Annotation Syntax

2015-11-26 Thread Pedro Cordeiro
Hi, Rowan. I'll respond to some points that have become recurrent. 1) It's might not be objectively bad to add this feature in docblocks, but it will be objectively wrong to keep calling them "DocBlocks" if they are no longer documentation-only blocks. 2) Even though PHP already treats docblocks

Re: [PHP-DEV] Native Annotation Syntax

2015-11-26 Thread Levi Morrison
> Ah, and please stop saying "it should be in docblock". This argument is > just bull... to suppress the actual people interested to see this natively > available and just exposes your lack of interest into language improvement. Every feature has a cost and benefit. It is perfectly fine to have th

Re: [PHP-DEV] Native Annotation Syntax

2015-11-26 Thread Rowan Collins
Hi Pedro, I agree with most of the points in your last mail. At the end of the day, the reasons are fairly subjective, and relate to how the feature will be perceived, and the freedom to design it without annoying people, but that doesn't stop them being real. However I would like to come ba

Re: [PHP-DEV] Native Annotation Syntax

2015-11-26 Thread guilhermebla...@gmail.com
Let's be clear. I haven't seen any user asking for traits, which introduced almost the same amount of performance cost and complexity to ZE. It was proposed by a "long term contributor" and everybody said yay. When multiple userland people ask about the same feature, every single major framework u

Re: [PHP-DEV] Native Annotation Syntax

2015-11-26 Thread Rowan Collins
guilhermebla...@gmail.com wrote on 26/11/2015 15:14: I haven't seen any user asking for traits Just because you didn't see it, doesn't mean it didn't happen. I just did a very quick search on Google for php + mixins, limited to 2007 or earlier (long before the current Trait implementation was

Re: [PHP-DEV] Native Annotation Syntax

2015-11-26 Thread Pedro Cordeiro
Hey, Rowan, don't apologize for making the case for what you believed to be the right way. I'm glad I could summarize my views in a way that you could agree with me. I've reread your point about the transpilers and obfuscators, and you're right, I misunderstood what you said. I'm sorry. Now, I'd

Re: [PHP-DEV] Native Annotation Syntax

2015-11-26 Thread guilhermebla...@gmail.com
Ok then. I'll pretend that lack of interest didn't happen many other situations (like http://marc.info/?t=14460876781) and move on. I don't want to bring the patch up to date/simplify it without a clear decision of at least be willing to discuss the patch and not reject by all means. I'd propo

Re: [PHP-DEV] Native Annotation Syntax

2015-11-26 Thread Chris Riley
On 26 November 2015 at 16:05, guilhermebla...@gmail.com < guilhermebla...@gmail.com> wrote: > Ok then. I'll pretend that lack of interest didn't happen many other > situations (like http://marc.info/?t=14460876781) and move on. > > I don't want to bring the patch up to date/simplify it without

Re: [PHP-DEV] Native Annotation Syntax

2015-11-26 Thread Rowan Collins
guilhermebla...@gmail.com wrote on 26/11/2015 16:05: Ok then. I'll pretend that lack of interest didn't happen many other situations (like http://marc.info/?t=14460876781) and move on. It's possible that a lot of the core devs are still concentrating on getting the changes in 7.0 bedded in

Re: [PHP-DEV] Native Annotation Syntax

2015-11-26 Thread Levi Morrison
On Thu, Nov 26, 2015 at 9:57 AM, Rowan Collins wrote: > guilhermebla...@gmail.com wrote on 26/11/2015 16:05: >> >> Ok then. I'll pretend that lack of interest didn't happen many other >> situations (like http://marc.info/?t=14460876781) and move on. > > > It's possible that a lot of the core d

Re: [PHP-DEV] Native Annotation Syntax

2015-11-26 Thread Pedro Cordeiro
Levi, I was asking about the reasons it was rejected. While researching, I found the original RFC was voted with 123 votes (71% approval), and yet was marked as 'declined'. I didn't know why, couldn't find why, so I figured I'd ask (as it strikes me as a major feature that's missing). 2015-11-26 1

Re: [PHP-DEV] Native Annotation Syntax

2015-11-26 Thread guilhermebla...@gmail.com
Answers inline On Thu, Nov 26, 2015 at 11:58 AM, Chris Riley wrote: > > On 26 November 2015 at 16:05, guilhermebla...@gmail.com < > guilhermebla...@gmail.com> wrote: > >> Ok then. I'll pretend that lack of interest didn't happen many other >> situations (like http://marc.info/?t=14460876781)