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.
I like the async/await additions. Seems very similar to the .NET implementation. Was this an inspiration?
Hack: a new programming language for HHVM
41–50 of 422 posts
Re: Hack: a new programming language for HHVM
#42I'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.
Say I'm starting out with an entirely new project and want to leave the legacy of dynamic typing behind. Is there a flag available to enforce the use of type signatures, causing Hack to throw a compilation error when they're omitted?
Re: Hack: a new programming language for HHVM
#43Re: Hack: a new programming language for HHVM
#44Re: Hack: a new programming language for HHVM
#45Earlier quoted context omitted.
Say I'm starting out with an entirely new project and want to leave the legacy of dynamic typing behind. Is there a flag available to enforce the use of type signatures, causing Hack to throw a compilation error when they're omitted?
Yes, "<?hh // strict" at the top of a file will do the trick.
Re: Hack: a new programming language for HHVM
#46I'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.
Would you consider adding even more expressive features like algebraic types or hygienic macros to the language?
Also how likely do you think it is that typical PHP will eventually be overtaken by HHVM? I'm hoping it will!
Re: Hack: a new programming language for HHVM
#47I'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.
At a glance it looks like Hack is to PHP what TypeScript is to JavaScript. Is that a fair analogy?
Re: Hack: a new programming language for HHVM
#48I 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 favorite thing to write there, though it didn't afford some of the same niceties and interactivity as the PHP code they had, only because the support was down by several orders of magnitude.)
But at the same time, layering FP with a home rolled static type checking server (??) is bug prone and is certainly yak shaving (which they have time and money to do). Now they've written (1) a compiler to C++, (2) a compiler to VM byte code, (3) a corresponding runtime for each, (4) extensions to PHP, (5) a type checker, and (6) an inference engine. That's a lot of stuff. And in the end, it's still PHP, which is duly disliked. (Though Facebookers don't seem to care. The prevalent attitude toward it is that "PHP, as it's coded here, is mostly like C++, and that's OK.")
Writing correct type checkers and inference engines is kind of difficult. They seemed to take the approach of just building onto it incrementally until it just seems to work. That approach led to many bugs in many cases that just simply aren't thought of when one is trying to build inference engines by hand, as opposed according to theory. Type checking and inference is an area ripe with theory and attached formal, mathematical semantics. Standard ML's standard is perhaps the most infamous; it's a collection of mathematical statements about the language. That way, the compiler is now almost an engine to prove your code is correct. I don't see how the same guarantee can be made with something that is just cobbled together.
Re: Hack: a new programming language for HHVM
#49Earlier quoted context omitted.
On Linux, we use the inotify subsystem to be informed every time you save a source file or switch branches. The hh_server process can then update its data structures immediately, without being explicitly asked.
I don't really get why this is the second paragraph on the page of a language though. It's like touting the jar command in an overview of Java.
One of the reasons that PHP has been such a success is that you can simply save a source file and reload a web page to see what's going on.
The server-based typechecker that runs instantaneously is what makes it possible for Hack to replicate this experience: you save a file and reload a web page, but you have the safety net of a typechecker that told you about your type errors as soon as you saved the file.
I can't overstate how important this instant feedback is: it's really the thing that distinguishes Hack from working in a more traditional compile-based static language.
Re: Hack: a new programming language for HHVM
#50I'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.