Live data from Hacker News

Ask HN: State of PHP at Facebook?

news.ycombinator.com

21–30 of 88 posts

Re: Ask HN: State of PHP at Facebook?

#21
Hack is open source.

My understanding from a talk back in 2014, is hack was developed because of frustrations with PHP evolution. Honestly I think it may have lit a fire under the PHP developers because php7 had significant speed improvements[4].

Talk:

"Facebook recently introduced and open-sourced Hack (https://code.facebook.com/posts/264544830379293/hack-a-new-p...), a gradually-typed programming language for HHVM that interoperates seamlessly with PHP. Hack builds the bridge between the dynamically and statically-typed worlds – providing code correctness while maintaining a fast feedback loop. Facebook is committed to working with the community to improve and refine the Hack language, to help interested developers convert to Hack (https://code.facebook.com/posts/264544830379293/hack-a-new-p...), and to narrow the HHVM compatibility gap with PHP5 and popular frameworks."

https://www.meetup.com/bostonphp/events/184609542/

Slidedeck on Hack (https://github.com/gabelevi/Boston-PHP-Meetup-Examples/blob/...)

[4] PHPs response to hack, phpng (php7): https://www.sitepoint.com/php-fights-hhvm-zephir-phpng/

https://news-web.php.net/php.internals/73888

Re: Ask HN: State of PHP at Facebook?

#22
At a high level think of Hack as Typescript for PHP. Although they completely replaced some data structures (i.e. arrays) that couldn't be made performant in their PHP implementation. Just like their customized version of MySQL, Facebook is stuck with Hack. It's too ingrained. Their customizations to MySQL became very specific to Facebook and they pretty much stopped open sourcing changes. Hack has taken the same path. They will never outsource Hack fully because some of the customization are only applicable to them.

Re: Ask HN: State of PHP at Facebook?

#23
post #20

Migrating to Hack from PHP was huge undertaking requiring years to conclude, and that almost kept the same syntax and semantics where possible. What would the benefit of spending thousands of engineer years (read: billions of dollars) on a rewrite be? Especially when it would nearly certainly come with a huge performance regression compared to continuing to use HHVM which has come with years of optimization for worki…

Do you know if Facebook uses Composer to manage PHP dependencies?

Re: Ask HN: State of PHP at Facebook?

#26
Ex-Facebooker here.

Hack isn't going away. Ever.

It's actually quite pleasant to develop in. The tooling now revolves around VS Code, which I personally don't like. I wish they'd based this on a Jetbrains core.

One thing I learned to love with the Hack type system is that nullability is a distinct type (eg you can assign a T to a ?T but not a ?T to a T; ? here means "nullable"). The static type checking is smart enough to figure out here:

    function foo(?Foo $foo): void {
      if ($foo is nonnull) {
        bar(foo);
      }
    }

    function bar(Foo $foo): void {
      ...
    }
that the null check changes the type from ?T to T within that block.

There's literally no reason to justify the massive investment a complete rewrite would be, like literally none. It's not even close.

HHVM and Hack at this point are extremely mature technologies.

Re: Ask HN: State of PHP at Facebook?

#27
post #26

Ex-Facebooker here. Hack isn't going away. Ever. It's actually quite pleasant to develop in. The tooling now revolves around VS Code, which I personally don't like. I wish they'd based this on a Jetbrains core. One thing I learned to love with the Hack type system is that nullability is a distinct type (eg you can assign a T to a ?T but not a ?T to a T; ? here means "nullable"). The static type checking is smart enou…

This is the second such PHP thread I've seen in the last 24 hours (the other one was on a different web property); gotta love people shitting on PHP like it's 1998

Re: Ask HN: State of PHP at Facebook?

#28
post #26

Ex-Facebooker here. Hack isn't going away. Ever. It's actually quite pleasant to develop in. The tooling now revolves around VS Code, which I personally don't like. I wish they'd based this on a Jetbrains core. One thing I learned to love with the Hack type system is that nullability is a distinct type (eg you can assign a T to a ?T but not a ?T to a T; ? here means "nullable"). The static type checking is smart enou…

Wow, that's almost the same thing that Typescript is to Javascript. Is all of that openly available to outsiders? If it is, I think I might to rethink my stance of php that I had for the last 15 years.

Re: Ask HN: State of PHP at Facebook?

#29
post #24

Has anyone used both Hack and the modern React workflow of Typescript and a mixture of client and server-side rendering? Interested to know how they compare

I haven't seen a huge emphasis on SSI + client other than projects like Next (which is ok but kind of clunky).

My experience with Hack was that it was just server-side ... is there some front-end aspect to Hack?

Post reply on HN