Announcement

Collapse
No announcement yet.

PHP 7.1 Makes Its Debut

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • #11
    Originally posted by uid313 View Post

    Annotations in comments are not real annotations, they are slow because they are read using reflection and parsing the comments.
    It would be better if PHP had native support for annotations. Now it is not supported, and implemented in frameworks by dirty hacks done using parsing comments.
    Yes, I code in Python, Java and C#.
    IMO Annotations are retarded, period. I wish people wouldn't bring this crap to frameworks I work on (regardless of language).
    I'm glad they are optional in any decent PHP framework, and I'm glad annotations are not in PHP core.

    Now, michal was a little rough on his reply, but here is mine:

    Your argument is pretty weak when you say it is implemented using dirty hacks.
    How the fuck do you think Java parses annotations? With vodoo magic?

    Comments are comments. Annotations is code inside comments, regardless of language.
    The concept itself is a hack.

    Saying annotations in PHP are slow also shows you unfortunately do not know what you are talking about.
    It's like saying "code generation is slow in language X", which is just... nonsense.

    Comment


    • #12
      Originally posted by Fidelix View Post
      Your argument is pretty weak when you say it is implemented using dirty hacks.
      How the fuck do you think Java parses annotations? With vodoo magic?

      Comments are comments. Annotations is code inside comments, regardless of language.
      The concept itself is a hack.

      Saying annotations in PHP are slow also shows you unfortunately do not know what you are talking about.
      It's like saying "code generation is slow in language X", which is just... nonsense.
      When it is implemented by the compiler, then it is a native implementation.
      When it is implemented by the framework using reflection then it is a hacked on implementation.

      I am sure a native implementation where the interpreter does the job in C would be faster than a framework writing it's own implementation in PHP that uses reflection and string parsing.

      Comment


      • #13
        Originally posted by Fidelix View Post

        You can already do service overrides very easily in Drupal: https://www.drupal.org/docs/8/api/se...namic-services
        [late reply]

        Yeah you can override and decorate services in a symfony app (like Drupal) but the decorators are still clumsy. The Drupal case would be more usefull if more core arch that needed overrides relied on service (entity handlers in particular.)

        Interestingly, using a decorator service shouldn't require any altering services: https://symfony.com/doc/current/serv...ecoration.html
        Last edited by jaxxed; 08 December 2016, 03:58 AM. Reason: added symfony decorator link

        Comment


        • #14
          Originally posted by uid313 View Post

          When it is implemented by the compiler, then it is a native implementation.
          When it is implemented by the framework using reflection then it is a hacked on implementation.

          I am sure a native implementation where the interpreter does the job in C would be faster than a framework writing it's own implementation in PHP that uses reflection and string parsing.
          So your problem with Annotations is just speed?
          Okay, then PHP non-native annotations are actually faster than Python's (as is the whole of PHP). Go check some benchmarks.

          But in the end it doesn't matter.
          It just has to be fast enough, and cacheable. But it's still bad as a concept.

          Comment

          Working...
          X