Live data from Hacker News

Hack: a new programming language for HHVM

code.facebook.com

151–160 of 422 posts

Re: Hack: a new programming language for HHVM

#151
post #85

Earlier quoted context omitted.

> I am baffled as to why you'd build your castle atop a crumbling foundation. Because perfect is not the enemy of the good? Because "build atop a crumbling foundation" has demonstrated time and again to be, by far, the most successful way to accomplish anything in computing? Unless you have some example of perfect, now dominant, technologies that have been created ex nihilo that I'm missing? I mean we (facebook) are…

Because "build atop a crumbling foundation" has demonstrated time and again to be, by far, the most successful way to accomplish anything in computing? I can't imagine where that sort of conclusion comes from. Building on a crumbling foundation seems to be just about the most proven, reliable way to ensure your software project won't survive more than a short time without needing serious effort just to maintain it an…

PHP is a "crumbling foundation" in exactly the same way DOS, Windows, COBOL, and C and C++ were, are, "crumbling foundations". I don't see how you are disagreeing with me. You are proving the point.

You aren't actually going to claim that Windows was well-conceived and theoretically well-founded, are you? Windows has been a never ending refinement on exceptionally shaky ground.

Re: Hack: a new programming language for HHVM

#153
post #129
post #108

Earlier quoted context omitted.

Which mainstream language would you have chosen in 2003 that you think would have had similar success?

> Which mainstream language would you have chosen in 2003 that you think would have had similar success? Bingo. In 2003 PHP was the best option to get from zero to hero.

As much as I'm not a PHP fan these days, you are completely correct. In 2003, you had CFM (which MySpace actually used at first), Java (and probably some overly complex framework like Jakarta Struts to go with it), CGI, or the new ASP.net. For a college student to do a quick HTML doc with some code interspersed here and there, PHP sounds like the ONLY viable option that didn't have you spending money on licensing, or setting up some huge infrastructure.

I used PHP/MySQL too as it was just dead simple for most things.

Re: Hack: a new programming language for HHVM

#154
post #108

Earlier quoted context omitted.

Which mainstream language would you have chosen in 2003 that you think would have had similar success?

Any. Really, any. Facebook is throwing a lot of engineering effort into fixing things that now matter to them, but didn't when they started (and were small). They could have picked Perl CGI's and it'd still have happened (perhaps Perl 6 would be a success these days). I don't think PHP has played any role in bringing FB to the size it is today (programming language does not translate to number of users signing up). S…

I disagree. Perl would have likely crippled them, due primarily to the lack of Perl engineers.

Re: Hack: a new programming language for HHVM

#155

I am baffled as to why you'd build your castle atop a crumbling foundation. I have wondered why FB didn't use a proper language with proper typing to begin with. I mean, I "understand" logistically: they already had a giant codebase in PHP, migrating a codebase is expensive, and it's difficult to hire and train 1000s of hackers in e.g., OCaml. (They do have some OCaml people, but they are outliers. OCaml was my favor…

> (3) a corresponding runtime for each

That's not really true, HPHP and HHVM share the runtime (mostly).

Re: Hack: a new programming language for HHVM

#156
post #37

Earlier quoted context omitted.

100% of our web front end developers use Hack now. This has been an organic process of growth over the past year, by which I mean our engineers are using it because they like it and see value in it, not because there's someone standing over them with a big stick :-) The biggest learning step for our engineering teams was to treat type errors from Hack as actual logic errors. We have a collection of "linters" that pro…

> Some people (quite reasonably) initially thought of Hack errors as lint-like stuff that it was safe to ignore, when in fact they indicate real logical inconsistencies in code. Interesting, thanks! One followup: what has it been like from an ops perspective? Similar to PHP, or is there a better frame of reference?

Can you rephrase your question about the ops perspective? Is there something in particular you want to know about?

Re: Hack: a new programming language for HHVM

#157

Man, it's going to be really hard to search the Internet to troubleshoot this. Search: "Hack Anonymous Function" Search: "Hack Background Process"

As a frequent user of R, this is one of my biggest pet peeves. There are a practically infinite number of unique, interesting, pronounceable, google-able names for a new programming language, yet we continue to get stuck with this shit.

A few months ago, "Martini" came out for "Go". I love the framework, but man, searching for stuff on Google was a PITA.

Re: Hack: a new programming language for HHVM

#158
post #134

Earlier quoted context omitted.

Engineer working on Hack here. Yeah, I think Hack is a good language to start a new project in. For as much flak as PHP gets, there are actually a lot of good things about the language. The fast development cycle -- edit php script, refresh -- is something amazing that you don't get in a lot of statically typed languages, which usually have a compilation step. The crazy dynamic things you can do also occasionally hav…

Er, `paste serve --reload` restarts small-to-medium Python projects faster than I can alt-tab, which is actually faster than my static blog engine can regenerate itself too.

The Facebook codebase is not exactly a small-to-medium project, so there is a fair bit of value in edit-and-reload.

Re: Hack: a new programming language for HHVM

#159
post #97

I haven't looked this over too much but I'm curious as to why they did this: instead of this: The first seems inconsistent to me. Especially coming from AS3/Haxe where the function return value is indicated in the same manner.

Would be more consistent to suffix the types in function decls as well, e.g. `increment($x: int)` vs. `increment(int $x)`.

Yep. So much weirdness here when they had a really good shot at "fixing" it.

Re: Hack: a new programming language for HHVM

#160

I haven't looked this over too much but I'm curious as to why they did this: instead of this: The first seems inconsistent to me. Especially coming from AS3/Haxe where the function return value is indicated in the same manner.

(I work on Hack at FB)

  function f(int $x): float { ... }
For property and constant declarations, we chose to be consistent with the parameter typehint syntax (int $x) instead of the function return type annotation (float).

A nice effect of this decision is that this allows us to change:

  class C {
    private int $x = 20;
    public function __construct(int $x,) {
      $this->x = $x;
    }
  }
into the shorter and cleaner:

  class C {
    public function __construct(
      private int $x = 20,
    ) {}
  }
Post reply on HN