Announcement

Collapse
No announcement yet.

PHP 7.1 Makes Its Debut

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

  • PHP 7.1 Makes Its Debut

    Phoronix: PHP 7.1 Makes Its Debut

    PHP 7.1 is now officially available...

    http://www.phoronix.com/scan.php?pag...P-7.1-Released

  • #2
    Looks like a nice release.

    Too bad it doesn't support decorators. Which would make it much easier to work with frameworks, example MVC frameworks.
    Decorators are supported in Python, Java and C#.

    Example from ASP.NET MVC in C#.
    Code:
    [Authorize]
    [HttpPost]
    public IActionResult Index()
    {
        return View();
    }
    So before the method is executed, it executes the Authorize decorator and the HttpPost decorator which checks if the request is valid for that method.

    Comment


    • #3
      Originally posted by uid313 View Post
      Looks like a nice release.

      Too bad it doesn't support decorators. Which would make it much easier to work with frameworks, example MVC frameworks.
      Decorators are supported in Python, Java and C#.

      Example from ASP.NET MVC in C#.
      Code:
      [Authorize]
      [HttpPost]
      public IActionResult Index()
      {
      return View();
      }
      So before the method is executed, it executes the Authorize decorator and the HttpPost decorator which checks if the request is valid for that method.
      I get what you're trying to say, but that provides no benefits for frameworks, and in fact is probably a violation of SOLID principles.
      And you can do decorators on PHP - in the right, OOP way.

      Comment


      • #4
        Originally posted by Fidelix View Post

        I get what you're trying to say, but that provides no benefits for frameworks, and in fact is probably a violation of SOLID principles.
        And you can do decorators on PHP - in the right, OOP way.
        It provides benefits to frameworks by making them easier to use by developers.
        Not sure which way it would violate the SOLID principles.

        You can't do decorators in PHP unless you mean;
        PHP Code:
        function index()
        {
            
        parent::decorators->authorize();
            
        parent::decorators->httpPost();
            return 
        parent::view();

        Meanwhile native support for decorators is available in many other languages such as Java, C# and Python. I think also Ruby.
        Last edited by uid313; 12-02-2016, 11:39 AM.

        Comment


        • #5
          What I care the most right now is about performance, has anyone benchmarked php 7.0 vs php 7.1?

          Comment


          • #6
            Originally posted by uid313 View Post

            It provides benefits to frameworks by making them easier to use by developers.
            Not sure which way it would violate the SOLID principles.

            You can't do decorators in PHP unless you mean;
            PHP Code:
            function index()
            {
            parent::decorators->authorize();
            parent::decorators->httpPost();
            return 
            parent::view();

            Meanwhile native support for decorators is available in many other languages such as Java, C# and Python. I think also Ruby.
            I was hoping to "inb4 missing decorators", but a conference call blocked me.

            Your decorator example isn't clear. You can almost do decorators, unless an interface declares the constructor, or unless you have particular reference requirements in an interface method (which is rare these days,) using __call().

            Truthfully though, any symfony project could appreciate better using native decorators, for service overrides (including frameworks like Drupal.)

            Comment


            • #7
              Originally posted by jaxxed View Post

              I was hoping to "inb4 missing decorators", but a conference call blocked me.

              Your decorator example isn't clear. You can almost do decorators, unless an interface declares the constructor, or unless you have particular reference requirements in an interface method (which is rare these days,) using __call().

              Truthfully though, any symfony project could appreciate better using native decorators, for service overrides (including frameworks like Drupal.)
              You can already do service overrides very easily in Drupal: https://www.drupal.org/docs/8/api/se...namic-services


              Originally posted by uid313 View Post

              It provides benefits to frameworks by making them easier to use by developers.
              Not sure which way it would violate the SOLID principles.

              You can't do decorators in PHP unless you mean;
              PHP Code:
              function index()
              {
              parent::decorators->authorize();
              parent::decorators->httpPost();
              return 
              parent::view();

              Meanwhile native support for decorators is available in many other languages such as Java, C# and Python. I think also Ruby.
              I don't think it makes it any easier and in fact should be avoided.
              Interfaces should be used for the example you gave me for instance.

              Comment


              • #8
                After reading all about “JavaScript: the good parts”, I once tried looking for “PHP: the good parts”, but found nothing...

                Comment


                • #9
                  Originally posted by ldo17 View Post
                  After reading all about “JavaScript: the good parts”, I once tried looking for “PHP: the good parts”, but found nothing...
                  http://shop.oreilly.com/product/9780596804381.do

                  there you go! have fun!

                  Comment


                  • #10
                    Originally posted by uid313 View Post
                    Looks like a nice release.

                    Too bad it doesn't support decorators. Which would make it much easier to work with frameworks, example MVC frameworks.
                    Decorators are supported in Python, Java and C#.

                    Example from ASP.NET MVC in C#.
                    Code:
                    [Authorize]
                    [HttpPost]
                    public IActionResult Index()
                    {
                    return View();
                    }
                    So before the method is executed, it executes the Authorize decorator and the HttpPost decorator which checks if the request is valid for that method.
                    Have you heard about annotations? They are supported by multiple php frameworks.

                    Code:
                     
                         /**      * @Route("/edit/{id}")      * @Method({"GET", "POST"})   
                          * @Security("has_role('ROLE_ADMIN')")  
                          */     public function editAction($id)     {     }
                    And if you are reffering to python, java and c# features you need to remember, that there are a lot of c++ features that these languages doesn't support. As you should know c++ is king of all languages and all other languages are useless tools for trolls and noobs.

                    BTW. do you even code in python, java or c#, or you are just a simple phoronix troll?

                    Comment

                    Working...
                    X