Hacker News new | ask | show | jobs
by hyperpape 4641 days ago
They're making three sorts of changes: 1) removing/restricting the footguns in the language 2) adding interesting features taken from other languages (typing, traits, etc). 3) creating a new VM with better performance.

As far as I can tell, only 3 is obviously something that only affects whether you can use the language once you have a certain number of users. The first two are really about changing the language.

3 comments

Maybe I should have expressed myself more clearly: The comment I replied to seemed to indicate that PHP must be bad since Facebook had a need to change it. My point was that, given the fact that Facebook has way more users than other sites and mostly serves non-cacheable pages, their needs are different than the needs of 99.9999% of other sites in the world, so the fact that they were forced to change PHP doesn't say anything about PHP's quality as a language.
The # of users really says nothing about how expressive the language you're programming in is.

And if we're talking about consumer products like facebook, it doesn't even say anything about how fast your programming language is since performance is dominated by database access time.

At best, we can try and claim that Facebook found PHP to be insufficiently expressive/safe/suited for them once they had X number engineers making Y number of changes per day.

Maybe they really could "move fast and break stuff" with 200+ engineers trying to commit to a vanilla PHP codebase.

Speaking as someone who works on a 2 million user enterprise app with standard PHP, i would have to counter that: 1) the footguns are easy to sidestep once you know them and are gradually getting removed, 2) standard php has traits and strict typing, but the typing is not for primitive types (which is what Hack adds) and 3) in nearly a decade i have had a single feature where i could have really used a faster php, whereas in practice my performance issues all come from the Oracle bottleneck because php is so easy to parallellize. Facebook could run on standard php, it would just require more hardware, and since releasing hhvm php has gotten a lot faster without breaking backwards compatibility.
I'm curious on how many servers does it run :)
PHP(.net) doesnt have strict typing ,but type hinting, which is not the same.
It does have strict typing with objects, but not literals.

If I make a function meow(MyClass $meow) { } it will throw errors if anything other than a MyClass is given to it, including NULL.

You are wrong , it has type hinting , not strict type checking. You can alias types, there is no hard types in PHP except for arrays. Your function signature check the name of the object in the namespace , not it's type.
function meow(MyClass $meow) { }

This will only accept an object that is_a MyClass. It can either implement an interface MyClass, extend an abstract MyClass, extend a regular class MyClass, or be the actual object MyClass.

Namespaces have nothing to do with this, other than you being able to use the "use" statement at the top to alias it.

they most probably would have made similar changes if they had used ruby or python. They have very specific problems brought on by massive scale which will expose the flaws in any scripting language.