The latter style doesn't (AFAICT) require single-lining, but setters and getters that do what would be naively assumed them to be do are a huge visual weight when in large volume. I am quite disappointed that less languages have tried novel solutions to that issue like C# has done with property declarations.
Setters and getters can be valued for different reasons - I like them, personally, because it both allows you to separate the setting logic from the getting logic - it allows you to control and track reference acquisition (when that's important) and it allows you to easily swap in more complex logic for the simple expressions without requiring code changes to leak outside of the primary file. As such I've always loved language features and tricks to avoid ever actually defining getters and setters unless I need to explicitly override that behavior - and PHP has some neat tools in this space with `__get` and `__set` magic methods.
Hiphop -- the Facebook project that compiled a PHP codebase into a monolithic executable, with an intermediate step as C++ -- was more of an alternate implementation than a separate language. But it's dead; Facebook abandoned that approach around 2013, and nobody seems interested in reviving it.
Hack started out as a superset of PHP, but it has diverged from the original language. Some of the features it was created to add (like type annotations and lambda functions) have since been added upstream, sometimes with different syntax; some of its other, stranger features (like XHP) are unlikely to ever be adopted upstream. At this point, it's best described as an incompatible fork.
>some of its other, stranger features (like XHP) are unlikely to ever be adopted upstream
XHP fixed one of the worst problems that PHP had, being a language intended to generate HTML that didn't recognize XML as a type, and so had no way to validate or contextually escape what it sent.
Sure, you can just use a templating framework like Twig to do it in PHP, or compile XHP into it, but you shouldn't have to.
Yea, but no. The one thing I really liked about PHP was the way it worked. You can always reason your way from script start to finish but there were/are a lot of problems with the language. The libs have problems, I don’t like where the syntax developed, the community ...
PHP needs a way forward and it needs to bring all the software along for the ride otherwise whatever comes next is useless and that’s a hard problem but I sort of doubt that this will help fix anything.
PHP is already cool. It allows our business to build performant and stable applications at a very rapid pace that is used by hundreds of thousands of users. There are other cool languages as well but we love the development speed of PHP.
I have some concerns about how some of the features might be implemented -- particularly the "readonly" property keyword -- but it's impossible to say for sure without seeing the code. (And I would be very disappointed if it turned out that the implementation doesn't exist yet.)
This submission should be removed. Not only it wasn't read for public access https://github.com/php-plus/engine but they are merging with another preprocessor project.
We already had this, it was called Hack. It mostly died an ignominious death because it was created by Facebook and people were worried Facebook would steal their IP if they used it. It was still awesome, though.
I'm curious who is actually using Hack etc. outside of Facebook.
Props to HHVM, though, it really did seem to act like the swift kick up the arse for PHP that it needed, demonstrating just how unnecessarily slow PHP was and spurring them to deal with that.
Hack isn't dead. At least Facebook uses it for everything backend related still. I'm not sure how they would steal anyone's IP by using it. Lots use React for example.
Granted, there's a big difference between mostly dead and all dead - mostly dead is slightly alive.
But until I see some Hack projects posted on Show HN, it's still dead enough to me. If there's no community development around it to speak of, there's no point in adopting it. I can't even get the repos I used to pull from to work anymore, Openshift never had proper support, no one seems eager to add support for hosting it, and no one is writing articles or updating docs for it as far as I can tell.
It hasn't reached the "rifle through Hack's pockets for loose change" state, but the prognosis doesn't seem good.
The last time I enjoyed PHP was in the 4.x days. I was never a fan of how classes were shoehorned into the language and I really dislike how PHP became a worse version of Java.