Live data from Hacker News

Hack: a new programming language for HHVM

code.facebook.com

91–100 of 422 posts

Re: Hack: a new programming language for HHVM

#91

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…

Are not coral reefs both beautiful and built upon the dead bodies of those who came before?

Re: Hack: a new programming language for HHVM

#92
post #3

I'm the manager of the team that developed Hack, and I'm sitting here with some of the language designers. Happy to answer your questions.

Could the same techniques you applied to PHP be applied to other dynamic languages like Ruby or Python?

If you're looking for a statically-typed version of Python/Ruby, I'd say nimrod gets fairly close. It's also fantastically fast and compiles to portable ANSI C.

Re: Hack: a new programming language for HHVM

#93

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…

(I work at Facebook but not on Hack.) There's a lot to be said about backward compatibility, and much of Hack's virtuosity stems in its smooth interoperability with PHP - many millions of lines of it. There's nothing like working on such a large codebase to convince one how difficult disruption of any kind is.

The language definition and semantic checker are difficult, but are stereotypically tasks that cannot be distributed to many engineers; instead, a few senior engineers took that task to the benefit of all others.

Re: Hack: a new programming language for HHVM

#94

Earlier quoted context omitted.

Why use public string $x = ''; instead of public $x:string = ''; It seems inconsistent to me, probably because I've used AS3/Haxe.

PHP is based on C. It's way more consistent with C, Java, C# , etc to do the former. So the real question is why function foobar() : int { .. } instead of function int foobar() { .. }

1. function foobar() makes it easier to grep for. 2. if I recall correctly, it made some parts of the grammar easier.

Re: Hack: a new programming language for HHVM

#96
post #47

Earlier quoted context omitted.

At a glance it looks like Hack is to PHP what TypeScript is to JavaScript. Is that a fair analogy?

Yes and no. Yes, because TypeScript is bringing a type-system to a dynamically typed language and so did Hack. No: because Hack is bringing some additional language features affecting the runtime. Modest changes for now, but we intend to carry on in that direction.

Well, it seems Microsoft is doing similarly with Typescript, except instead, waiting for the spec to catch up. I like both ideas.

Re: Hack: a new programming language for HHVM

#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)`.

Re: Hack: a new programming language for HHVM

#98
post #87

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…

The HN crowd seems to dislike (or despise perhaps?) PHP, but it's really not that bad. Yes it has a lot of warts, but it has a lot of things that make it nice for web development. a) try your new code by saving in your editor, and hitting reload in your web browser. b) it's very approachable. People who only know HTML and CSS can be expected to do a little bit of PHP work to integrate their changes. If you setup the…

a) WTH? I hope you do not test your code in production. If you don't that feature (a ide that constantly compiles your code) is a common feature.

b) Theorem: Leting your web designers program is a way worse than letting your programmers do web design.

c) Every simple project can become complex at some point. Facebook certainly is.

Re: Hack: a new programming language for HHVM

#100

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…

Facebook is doing an admirable job replacing rotting pieces of their infrastructure with more robust replacements.

HHVM replaced the execution environment for their code with a more robust code generation/ runtime system.

Hack allows them to bootstrap their code base into higher degrees of reliability without a mass rewrite.

Also Brian O'Sullivan is one of the best people on the face of the earth to be trying to find practical ways on integrating PL research into practical engineering.

Post reply on HN