News for hackers. Stuff that matters.
Re:PHP 8: Before and After by stabbles on Friday October 23, 2020 @03:43AM (#24866960)
I'm glad you can now write:

    public static function new(): static
    {
        return new static();
    }
It really brings the point across it's static.
Re:PHP 8: Before and After by brendt_gd on Friday October 23, 2020 @03:45AM (#24866972)
I know you're trolling, but FYI the `static` before function has nothing to do with the `static` return type. Like other programming languages the term `static` is used to denote two things.
Re:PHP 8: Before and After by ThePadawan on Friday October 23, 2020 @04:37AM (#24867226)
And other programming languages get away wihout overloading the term.

It's not an excuse for slacking on language design.

Re:PHP 8: Before and After by int_19h on Saturday October 24, 2020 @10:52PM (#24883509)
"static" itself is originally an overloaded term, and still remains such to this day in C++.
Re:PHP 8: Before and After by stabbles on Friday October 23, 2020 @03:47AM (#24866986)
The term is overloaded, which is a bit unfortunate.
Re:PHP 8: Before and After by hashtagmarkup on Friday October 23, 2020 @03:58AM (#24867036)
However, the unfortunateness is static.
Re:PHP 8: Before and After by joseluisq on Friday October 23, 2020 @03:49AM (#24867001)
> It really brings the point across it's static.

A bit better, due from 7.x backward it really doesn't transmit any sense to me. Just confusion. And I'm not alone. See https://www.reddit.com/r/PHP/comments/elrnp4/rfc_for_static_...

Re:PHP 8: Before and After by pornel on Friday October 23, 2020 @05:17AM (#24867452)
C did it first:

    static a(int a[static 1]);
Re:PHP 8: Before and After by diamondo25 on Friday October 23, 2020 @03:57AM (#24867032)
Why didnt they use the term singleton or object?
Re:PHP 8: Before and After by jorams on Friday October 23, 2020 @04:29AM (#24867192)
What would they use it for? The first 'static' means the method is a part of the class rather than the instances of that class. The second and third 'static' indicate late static binding, meaning they refer to the class being called, rather than the class defining this method.
Re:PHP 8: Before and After by quietbritishjim on Friday October 23, 2020 @05:00AM (#24867342)
(Disclaimer: I know absolutely no PHP whatsoever.)

> The second and third 'static' indicate late static binding, meaning they refer to the class being called, rather than the class defining this method.

Wait, so they're using "static" to mean the binding is happening later? Isn't that essentially less static than binding against the class being defined?

Re:PHP 8: Before and After by spdionis on Friday October 23, 2020 @07:32AM (#24868357)
It's still static in the sense that the method is tied to a class, not to an object instance. Does that mean it's "less" static? I wouldn't say so.
Re:PHP 8: Before and After by quietbritishjim on Friday October 23, 2020 @08:51AM (#24868908)
Well then I guess we'll have to agree to disagree :-)

It's less static than a method dependent on the object instance, but more static than a method that doesn't even depend on the class. If I've understood correctly (which I quite possibly haven't, in fairness), these are analogous to Python's static methods, class methods and regular methods, and its static methods really are the "most" static.

Re:PHP 8: Before and After by codeulike on Friday October 23, 2020 @06:55AM (#24868116)
and new