Live data from Hacker News

Hack: a new programming language for HHVM

code.facebook.com

371–380 of 422 posts

Re: Hack: a new programming language for HHVM

#371
post #228

Earlier quoted context omitted.

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…

Perl was a possibility, but CGI is/was a pain to use. To get started you had to understand things like headers. You frequently had scripts refusing to run for whitespace issues relating to CRLF vs LF. You'd need to come up with your own templating language... It was just much more difficult. Also Perl libraries typically require superuser rights to install. That's a big deal if you're a poor student using shared host…

> To get started you had to understand things like headers

since when is this a problem? really.

Re: Hack: a new programming language for HHVM

#372

Earlier quoted context omitted.

What was the stupid decision "made back then"? That Zuck wrote the first version of thefacebook.com in PHP, the language he was the most productive at? That the initial team didn't rewrite Facebook in Python/Perl/Ruby/Haskell during the fast growth phase? If you have ever experienced the growth phase, you understand how ludicrous the idea of rewrite would be. I've personally experienced and heard only horror stories…

A rewrite isn't such a ludicrous idea. Reddit is a prime example of a rewrite from Lisp to Python. I would say that's even a somewhat difficult rewrite.

Okay, Reddit is a good example of a successful rewrite during a growth phase. I had forgotten that. As I've personal knowledge of several unsuccessful rewrites, it would be great to hear more anecdotes about successful rewrites in growth phase and try to analyse what made them succeed.

Rewrite is more likely to succeed if you are not in a high growth phase, but even then it's risky.

Re: Hack: a new programming language for HHVM

#373
post #238

Earlier quoted context omitted.

Given a programming task, it will be written faster, easier, and in a more maintainable and less bug-prone fashion if it is not PHP. The opposite opinion is basically indefensible. Sure, you can still dig a trench with a spoon (and if you have enough money to wield a bunch of workers with a spoon), even if a shovel would do a better job. Let's begin. 1) PHP autocraptastically converts strings that look like numbers,…

I can't fathom why you're under the impression that some code hasn't been switched to another language. Furthermore, your vitriol seems quite effective at undermining your thesis.

Fair enough. And to be honest, there was a single night not too many years ago where I wrote up an auction site that had most of the functionality of eBay, in a single night, in PHP (someone else had already done the frontend work, fortunately- I just built the backend).

Re: Hack: a new programming language for HHVM

#374

Earlier quoted context omitted.

C, simple and predictable? You've got to be kidding me: http://lwn.net/Articles/586838/

It can definitely be simple, but if you're writing C you're compiling directly on hardware. If you change the hardware, your program will not run. That is literally the definition of unreliable.

Reliability can be measured in successes and failures. Failing reliably is not necessarily a bad thing. Some things you build may or may not work on other hardware. That's unreliable. You assert, with confidence, that C will fail. That's reliable. You can rely on it failing.

Re: Hack: a new programming language for HHVM

#375

Earlier quoted context omitted.

Given a programming task, it will be written faster, easier, and in a more maintainable and less bug-prone fashion if it is not PHP. The opposite opinion is basically indefensible. Sure, you can still dig a trench with a spoon (and if you have enough money to wield a bunch of workers with a spoon), even if a shovel would do a better job. Let's begin. 1) PHP autocraptastically converts strings that look like numbers,…

You're making a mistake. The question is not whether to start a company with PHP vs language X. The company is long started. The question is not whether or not to poof into existence a port from all of FB to language X. That's not possible. The question is, given that PHP is the current language, with all its faults, will it it cost more (including all definitions of cost) to make the switch? How long will it take? D…

> The question is, given that PHP is the current language, with all its faults, will it it cost more (including all definitions of cost) to make the switch? How long will it take? Does it get the job done? How bad is the damage?

An excellent point. Which in fact is an argument in favor of modularizing your code as much as possible, as early as possible. There are tools now like Apache Thrift which make this easier: http://thrift.apache.org/

Re: Hack: a new programming language for HHVM

#376

Earlier quoted context omitted.

http://docs.codehaus.org/display/JETTY/Maven+Jetty+Plugin

Yeah, that's the one we're using. Still takes a couple of seconds, though. And as I said, big changes can't be reloaded, so the whole server will have to be restarted.

>Still takes a couple of seconds, though

How big is your code base, and is it all in one huge file or something? Our stuff is reloaded and ready before I've alt+tabbed back and hit refresh.

Re: Hack: a new programming language for HHVM

#377

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 dis…

What editor do facebook recommends for hack? Pho storm doesn't support it yet unfortunately

Re: Hack: a new programming language for HHVM

#378
post #218

Earlier quoted context omitted.

Do you think perl would have been much better? Either way, the point that he was making was that there were pretty slim pickings back then. Certainly the dominant languages/frameworks of WD these days (python, ruby, node) didn't exist. Or by another token, the only dominant one that was also strong back then is PHP, the one they chose.

Yeah, Node didn't exist. Python was over ten years old in 2003. In Python web development there had already been CGIs, mod_python and two major releases of Zope, with hope of Zope 3 on the horizon. Ruby is almost as old as Python.

I'm aware that they existed, but clearly they were very immature as compared to how they are now. PHP on the other hand was in it's heyday, and (clearly) fulfilled all of the needs of Zuckerberg and the other developers. A suggestion at the time that they use a language like ruby or python would probably never have been made, and for good reason - and it almost certainly wouldn't have been adopted. It's just not realistic to suggest that early FB had this vast array of choices for which language to use.

Re: Hack: a new programming language for HHVM

#379
post #343

So argue. Much armchair quarterback. Very flame. Wow. It's entirely appropriate and reasonable to say "I don't understand why Facebook would do this; please explain it to me." But it reflects a supreme lack of humility to say "I don't understand why Facebook would do this; they must be idiots, and when they, armed with inside information I don't even know I don't have, come to defend themselves, I will angrily try to…

Wish I could upvote this a bunch of times

Re: Hack: a new programming language for HHVM

#380

Earlier quoted context omitted.

Given a programming task, it will be written faster, easier, and in a more maintainable and less bug-prone fashion if it is not PHP. The opposite opinion is basically indefensible. Sure, you can still dig a trench with a spoon (and if you have enough money to wield a bunch of workers with a spoon), even if a shovel would do a better job. Let's begin. 1) PHP autocraptastically converts strings that look like numbers,…

You're making a mistake. The question is not whether to start a company with PHP vs language X. The company is long started. The question is not whether or not to poof into existence a port from all of FB to language X. That's not possible. The question is, given that PHP is the current language, with all its faults, will it it cost more (including all definitions of cost) to make the switch? How long will it take? D…

> The question is not whether or not to poof into existence a port from all of FB to language X. That's not possible.

And yet Twitter has slowly migrated on the backend from Ruby to Scala/Java. They still use Ruby for the frontend, though it's not clear to what extent, since they've also migrated to a single-page, fat client design on the desktop. And at the very least, their choice of using Ruby when prototyping, was at least sane.

I understand that large codebases can't be migrated easily. But you can migrate individual components when needed, if you have a modular, service-oriented design.

Also - building new functionality in PHP is indefensible, unless their code-base is one big monolithic hairball, which I doubt it is.

Post reply on HN