Announcement

Collapse
No announcement yet.

PHP 7.1 Alpha Released With Void Return Type, Multi Catch

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

  • PHP 7.1 Alpha Released With Void Return Type, Multi Catch

    Phoronix: PHP 7.1 Alpha Released With Void Return Type, Multi Catch

    The first alpha release was made available on Thursday for the upcoming PHP 7.1...

    Phoronix, Linux Hardware Reviews, Linux hardware benchmarks, Linux server benchmarks, Linux benchmarking, Desktop Linux, Linux performance, Open Source graphics, Linux How To, Ubuntu benchmarks, Ubuntu hardware, Phoronix Test Suite

  • #2
    Some good stuff in this next release. Looking forward to it

    Comment


    • #3
      Out of curiousity (I'm not a php hacker), what's the appeal for a ​void return type?

      Comment


      • #4
        Originally posted by Mystro256 View Post
        Out of curiousity (I'm not a php hacker), what's the appeal for a ​void return type?
        not a php hacker either, but "void return type" is a type of function/method that does not return any value back to the main code.

        The obvious usecase is the low-level functions used to print something on console/screen/file, they just take stuff and write stuff to console/screen/file, no return value. Error-handling (if needed) will be done by other methods using these low-level functions too, but adding stuff on top.

        Or sorter functions. Or whatever modifies data in-place. Low-level methods don't usually need error-handling as that is done by others.

        Comment


        • #5
          I'm surprised there are people still using PHP!

          Comment


          • #6
            Originally posted by starshipeleven View Post

            not a php hacker either, but "void return type" is a type of function/method that does not return any value back to the main code.

            The obvious usecase is the low-level functions used to print something on console/screen/file, they just take stuff and write stuff to console/screen/file, no return value. Error-handling (if needed) will be done by other methods using these low-level functions too, but adding stuff on top.

            Or sorter functions. Or whatever modifies data in-place. Low-level methods don't usually need error-handling as that is done by others.
            Wait, are you saying PHP didn't have functions that wouldn't return anything?
            I think I misunderstood this, i.e. like I thought it was returning void types? Haha, I guess I just assumed all languages had a way to return nothing.

            Comment


            • #7
              Originally posted by Mystro256 View Post
              Wait, are you saying PHP didn't have functions that wouldn't return anything?
              I think I misunderstood this, i.e. like I thought it was returning void types? Haha, I guess I just assumed all languages had a way to return nothing.
              Of course there was always a way to return nothing. It's done by simply not returning something

              In a previous version _explicit_ return types were introduced so you could tell that a function only returns a certain type. Not specifying any type as a return type now means two things: either something without a specific type is returned (the type may even switch depending on the input) or nothing is returned.
              What's new now is that you can now _explicitly_ say this function returns nothing (and the compiler makes sure that you don't return anything).

              Comment


              • #8
                Originally posted by wizard69 View Post
                I'm surprised there are people still using PHP!
                what to use otherwise?

                Comment


                • #9
                  Originally posted by droste View Post
                  Of course there was always a way to return nothing. It's done by simply not returning something
                  Is stating explicitly that a function returns void instead of simply not returning anything a way to defend against some buffer overflows/code injection/whatever?

                  I'm half sure that if something manages to inject code in your method (or you make mistakes) but the compiler knows that the method should be void it will probably NOT happily read any "return <fishystuff>" it finds.

                  Originally posted by cj.wijtmans View Post
                  what to use otherwise?
                  Phyton for example. Much more consistent and much less of a shit to work with.
                  Hell, even java is less of a shit to work with, but it's not anywhere near as performant as PHP.

                  Still, wizard was very likely trolling. PHP is still pretty fucking common everywhere.

                  Comment


                  • #10
                    Originally posted by starshipeleven View Post
                    Still, wizard was very likely trolling. PHP is still pretty fucking common everywhere.
                    you can find a McDonalds nearly everywhere too. Prevalence and ready availability doesn't necessarily mean good.
                    Mcdonald's fast food is quick and easy, just like PHP, but it's not good for you either.

                    when was the last time you read of a significant server hack that was due to java itself - not bad programming but actually due to the java VM?

                    Comment

                    Working...
                    X