Post AX9aBbgocdioiUoz7A by wogan@mastodon.africa
 (DIR) More posts by wogan@mastodon.africa
 (DIR) Post #AX9XJ57hHtDcATGeki by dandb@mas.to
       2023-06-28T14:26:29Z
       
       0 likes, 0 repeats
       
       Generics in #PHP would make my life so much easier today.
       
 (DIR) Post #AX9XJ5uGNK4Cb5zRS4 by wogan@mastodon.africa
       2023-06-28T14:27:40Z
       
       0 likes, 0 repeats
       
       @dandb Not a day goes by that I don't miss generics :(
       
 (DIR) Post #AX9XXfbkR2OhNSHQ6C by dandb@mas.to
       2023-06-28T14:30:19Z
       
       0 likes, 0 repeats
       
       @wogan Yup, like I understand why PHP doesn't have them but it still sucks.
       
 (DIR) Post #AX9YGqHjaHh3WVSUHQ by ramsey@phpc.social
       2023-06-28T14:33:57Z
       
       0 likes, 0 repeats
       
       @dandb @wogan The only reason PHP doesn’t have them is because they’re very hard to implement without significantly slowing down the engine. If someone is able to solve that, they’ll be added.
       
 (DIR) Post #AX9YGuGoldKxsp3oPI by wogan@mastodon.africa
       2023-06-28T14:38:28Z
       
       0 likes, 0 repeats
       
       @ramsey @dandb I just went down that rabbithole and found nikic's answer that broke down the work involved, and it looks like an honest-to-god beast to fold into the engine itself: https://www.reddit.com/r/PHP/comments/j65968/comment/g7zg9mt/I don't suppose anyone's tried going down the "TypeScript" route here? Is it possible to write an intermediate language that can transpile to valid PHP safely?
       
 (DIR) Post #AX9YTQCjrX9yOt7Vmi by wogan@mastodon.africa
       2023-06-28T14:40:45Z
       
       0 likes, 0 repeats
       
       @ramsey @dandb Also, seems Facebook figured out (back before they were Meta), and got generics into hacklang: https://docs.hhvm.com/hack/generics/introduction - wonder how they did that.
       
 (DIR) Post #AX9YtOvPF5WVxeOuvo by dandb@mas.to
       2023-06-28T14:45:25Z
       
       0 likes, 0 repeats
       
       @wogan @ramsey Hack has both generics which are runtime stripped and reified generics that aren't.No idea about the performance implications of reified generics tho.
       
 (DIR) Post #AX9Z83wvVjqrFb6T0C by wogan@mastodon.africa
       2023-06-28T14:48:06Z
       
       0 likes, 0 repeats
       
       @dandb @ramsey Just browsing all of this now, it looks like it would be theoretically possible to port a dockerized Laravel project to HHVM without losing any functionality, but gaining a bunch of new stuff (like generics).I'm a noob when it comes to hacklang though - is there a good reason *not* to do this?
       
 (DIR) Post #AX9ZP5rRemvK6Of04G by ramsey@phpc.social
       2023-06-28T14:51:08Z
       
       0 likes, 0 repeats
       
       @wogan @dandb Hacklang (and PHP on HHVM) was re-written from the ground up (mostly), so neither had to contend with the existing internals of Zend PHP.
       
 (DIR) Post #AX9ZbFC2mlouWL5aDY by ramsey@phpc.social
       2023-06-28T14:51:23Z
       
       0 likes, 0 repeats
       
       @wogan @dandb TypeScript was created with default tooling in mind to enforce the type system. Everyone who uses TypeScript uses that tooling. Since, the types are “erased types,” if you don’t use the tooling, there’s nothing to enforce the types at runtime, which means any pure JS code that uses your TypeScript library (after it’s been transpiled to JS) gets zero type-safety guarantees.
       
 (DIR) Post #AX9ZbFvm2kOqoAU6Uq by ramsey@phpc.social
       2023-06-28T14:51:39Z
       
       0 likes, 0 repeats
       
       @wogan @dandb As a library author, “erased types” provide me with zero type-safety. I would still need to write all the internal validation code to ensure that what I receive from the caller is the type I expect it to be, and throw my own exceptions.
       
 (DIR) Post #AX9ZbGbxVu8yv0DnFY by wogan@mastodon.africa
       2023-06-28T14:53:22Z
       
       0 likes, 0 repeats
       
       @ramsey @dandb Ok so we definitely don't want that then 😂 I didn't know that HHVM was that substantial a rewrite, I honestly thought it was just a big fork. But doesn't it beg the question "why is Zend not HHVM" or "why is the industry not using HHVM instead"?Is it a "Facebook's ownership is problematic" scenario, or something else? Because if HHVM is a straight upgrade (in DX terms anyway) from PHP, why is it not already the standard?
       
 (DIR) Post #AX9ZpWzbPAJVmK59pg by ramsey@phpc.social
       2023-06-28T14:55:54Z
       
       0 likes, 0 repeats
       
       @wogan @dandb While you might be able to run PHP on HHVM, they do not officially support it as of v4.0.0.So, if you port everything over to Hack, you’ll lose out on the wide ecosystem of Composer packages, and I doubt Laravel will work, since any PHP that still runs in HHVM is not likely to support anything from PHP 7.3 or newer.https://hhvm.com/blog/2018/09/12/end-of-php-support-future-of-hack.html
       
 (DIR) Post #AX9aBb3oxcWulYZqKm by ramsey@phpc.social
       2023-06-28T14:59:16Z
       
       0 likes, 1 repeats
       
       @wogan @dandb The primary reason to move to HHVM in the past were the performance gains, but PHP 7 began outperforming HHVM, and HHVM decided not to keep up with PHP progress. Companies like Wikimedia, who had switched to HHVM for performance, switched back to Zend PHP.The only reason to use HHVM now is if you want to use Hack, which is a great language, and I think you might still be able to intermingle PHP libraries that support PHP 7.2 and earlier.
       
 (DIR) Post #AX9aBbgocdioiUoz7A by wogan@mastodon.africa
       2023-06-28T14:59:57Z
       
       0 likes, 0 repeats
       
       @ramsey @dandb Thank you! Appreciate that you took the time to answer that one :)So it's a choice between "the entire PHP ecosystem minus generics" or "Meta's PHP-lookalike with generics and limited ecosystem support", and man, given that choice I would rather not have generics 😭
       
 (DIR) Post #AX9aFJKmoClKwmHdi4 by ramsey@phpc.social
       2023-06-28T15:00:31Z
       
       0 likes, 0 repeats
       
       @wogan @dandb I think I covered this in another branch of this convo, but let me know if this doesn’t cover it:https://phpc.social/@ramsey/110622418851764809
       
 (DIR) Post #AX9c3MKI3h9SeyTpvE by ramsey@phpc.social
       2023-06-28T15:20:49Z
       
       0 likes, 0 repeats
       
       @wogan @dandb The only two companies I know who have massive HHVM installs are Facebook and Slack. They both chose to go all-in on Hack.To answer your question about why the community didn’t go with HHVM over Zend… it was really a toss-up at one point. It could have gone that way, but then, patches were submitted for “phpng” (PHP, next generation) that solved a lot of the performance issues, and that eventually became PHP 7.
       
 (DIR) Post #AX9cX1WFz0QQodDrOK by wogan@mastodon.africa
       2023-06-28T15:26:14Z
       
       0 likes, 0 repeats
       
       @ramsey @dandb That effectively makes Hack a proprietary language, in that it only grows as far as companies are willing to throw money at the developers working on it, right?I'm glad the tossup resolved the way it did, though - can't imagine the chaos of forking PHP given the scale it's currently deployed at. Would probably dwarf the node.js/io.js drama by orders of magnitude.
       
 (DIR) Post #AX9da5WPerTy3IJwh6 by ramsey@phpc.social
       2023-06-28T15:37:53Z
       
       0 likes, 0 repeats
       
       @wogan @dandb Or the confusion that is the Python ecosystem.CPythonJythonPyPyRPythonIronPython
       
 (DIR) Post #AX9doOnQnD8Rsw6Yro by wogan@mastodon.africa
       2023-06-28T15:40:34Z
       
       0 likes, 0 repeats
       
       @ramsey @dandb I'm going to pretend like I know what any of those are, because last I checked, all I knew about was the "Python v2 to Python v3" drama, and that was enough for me!
       
 (DIR) Post #AX9dvaTJmW3I7i7nRA by ramsey@phpc.social
       2023-06-28T15:41:46Z
       
       0 likes, 0 repeats
       
       @wogan @dandb They’re all different runtimes for Python (well, RPython is the Python language subset that PyPy is written in, so I guess it’s not a runtime).