Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I think this is quite a good technical reason:

    Because code comments should never be necessary for a script to function properly. 
In which other language do you see comment is necessary to make the code function properly?


In which other language do you see comment is necessary to make the code function properly?

Oracle SQL hints come to mind: http://www.dba-oracle.com/t_sql_hints_tuning.htm

There is it even worse because the hint may be needed to make your code run, but Oracle doesn't tell you whether or not the hint is actually in use or made a difference.


> In which other language do you see comment is necessary to make the code function properly?

If by "language" you mean "some library which also provides a separate but way more painful and verbose way of doing the same thing", then it existed in Java before Java 5 added annotations to the language itself.


I never know that, but still, the point stands: making a comment necessity for code to function properly is bad, bad, bad. That's why the Java folks throws it out right?


> I never know that, but still, the point stands: making a comment necessity for code to function properly is bad, bad, bad.

Not really.

> That's why the Java folks throws it out right?

I'm not sure what that's supposed to mean. "Java folks" don't throw anything out, Sun introduced a better and better-supported mechanism for doing what javadocs were coerced into doing.


> I'm not sure what that's supposed to mean. "Java folks" don't throw anything out, Sun introduced a better and better-supported mechanism for doing what javadocs were coerced into doing.

I mean the Java community didn't use it anymore, because the "annotation inside comment" thing is worse than "annotation supported natively by the language". Granted, it's the only practical way to do it in PHP for now, but it still didn't change the fact that it's bad, IMO.

I wonder why SensioLabs (the creator of Symfony and Doctrine) didn't make the PHP's annotation RFC into reality. They are a quite huge powerhouse in the PHP world...


> I mean the Java community didn't use it anymore, because the "annotation inside comment" thing is worse than "annotation supported natively by the language".

Sure, unless you don't have "annotations supported natively by the language".

> Granted, it's the only practical way to do it in PHP for now

Indeed.

> I wonder why SensioLabs (the creator of Symfony and Doctrine) didn't make the PHP's annotation RFC into reality. They are a quite huge powerhouse in the PHP world...

They might be a powerhouse, but they still aren't the drivers of PHP itself, Zend is. They can ask for the RFC to be finalized and implemented but at the end of the day, they also need to ship. And probably to ship on more versions than a hypothetical future 5.5.


[deleted]


> No, Java uses the same syntax with annotation inside comments.

Mostly incorrect, these are javadoc annotations which usually aren't used by code (aside from the javadoc extraction tool that is, and sometimes code editors for the @deprecated javadoc tag)

Since java 5, java has notations as language syntax e.g.

    /**
     * Some javadoc comment
     */
    @Annotation
    public void someMethod() {
        // stuff
    }
http://docs.oracle.com/javase/tutorial/java/javaOO/annotatio... which are supported by a formal extraction framework and are syntax- and type-checked by the java parser itself, and attached as metadata to classes and methods by the same.

Before java5, these were inside comments (alongside javadoc tags), fully processed by third-party tools and had no support from the JVM itself.


Its a syntax problem then ? what if the annotation wasn't inside comments would that make it ok ?


I think yes. It's ok if it's not inside comments. Just like any other language (I know at least C# and Java do this for example).


A lot of this boils down to PHP's feeble "array" declarator. Take a page from JavaScript and make it easy.


As of PHP 5.4 you can use [] to define arrays. It saves some typing, and is less noisy on the eyes I guess.


That's exactly the way it should be. Hopefully this will become the standard before long.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: