Remix.run Logo
kevincox 11 hours ago

It is an interesting comparison that JavaScript always ensures that different evaluations of a closure expression results in unique instances. So in general the closures will require allocations for each (unless the allocation is otherwise prevented such as via escape analysis). Of course much of the underlying data may be shared, but the identity itself will be unique.

I don't know how strict JavaScript garbage collection rules are. This was non-observable for the longest time but FinalizationRegistry now exists which makes cleanup observable. It sounds like basically no guarantees are provided when an object will be cleaned up, so presumably an implementation would be allowed to make optimizations such are proposed where for PHP.

eurleif 8 hours ago | parent [-]

The part that would violate guarantees in JavaScript is not function objects being kept alive longer, but function objects which should be distinct not being so.

    function foo() {
        return function() { };
    }
    console.log(foo() === foo()); // This must log `false` in a compliant implementation
ragnese 5 hours ago | parent [-]

This is also a problem, IMO, in having this optimization in PHP. Anonymous functions are instances of a Closure class, which means that the `===` operator should return false for `foo() === foo()` just like it would for `new MyClass() === new MyClass()`.

But, since when has PHP ever prioritized correctness or consistency over trivial convenience? (I know it's anti-cool these days to hate on PHP, but I work with PHP all the time and it's still a terrible language even in 2026)

tialaramex an hour ago | parent | next [-]

I never understood why people think somehow PHP is fine now, and I've had that opinion expressed several times on HN. The best I can make out is that people's expectations are so dismal now that they're like "Well new versions fixed 2 of the 5 worst problems I noticed, so that's good right?"

cardanome 22 minutes ago | parent [-]

Because PHP is a amazing backed language for making CRUD apps. Always has been.

It has great web frameworks, a good gradual typing story and is the easiest language to deploy.

You can start with simple shared hosting, copy your files into the server and you are done. No docker, nothing.

Sure it has warts but so have all mainstream programming languages. I find it more pleasant than TypeScript which suffers from long compile times and a crazy complex type system.

The only downside is that PHP as a job means lots of legacy code. It a solid career but you will rarely if ever have interesting programming projects.

phplovesong 3 hours ago | parent | prev [-]

Its bad indeed. Its unfixable at this point. We just get bolton features.