In the weeks since the Hack open source launch and the Hack developer day, there has been a lot of information, code, blog posts, etc coming from our nascent community. To us on the team, it’s been incredible and encouraging to see the community reception to Hack. Here are some of the highlights of the things we’ve seen come out of our community. (And we almost certainly haven’t seen everything, so please let us know in the comments what we’ve missed!)
The folks at PocketRent, some of the earliest adopters of Hack, have a small Hack framework. Even if you aren’t interested in using it directly, there are great examples of everything from XHP to async functions.
Victor Berchet has released a Vagrant configuration to help get HHVM and Hack up and running in a VM as quickly as possible. Many folks have had trouble getting HHVM and Hack up and running, and while we’re trying to improve that process moving forward, if you’re one of those folks, you may want to give it a try.
Brian Scaturro has begun work on HackUnit, an xUnit testing framework written in Hack.
For the visually inclined, Charles Zink has made a YouTube video demonstrating how to get HHVM, Hack, and Nginx all playing nice on Debian 7.
Christian Stocker gave a presentation on HHVM, Hack, and his experiences using them in production.
Several folks posted their reactions to our Hack dev day. Jeremy Mikola wrote an extensive summary of each of the talks, which is highly recommended if you don’t have time to watch all of the videos. On the other hand, Michael Curry has a nice short post picking out just his highlights from the day.
Before the Hack release, Victor Berchet wrote a series on the Hack language (part 1, part 2). He’s got lots of good information on the Hack type system and what it might mean for current PHP developers. Just keep in mind it was written before the official release, and so many of the things listed as “not documented” should in fact now be well documented.
FastCompany Labs ran a nice story on Hack and its motivation, including interviews with Hack tech lead Julien Verlaguet and HHVM tech lead Ed Smith. Similarly, O’Reilly Programming ran a blog post discussing Hack and its coexistence with PHP. Finally, Programmable Web ran a short overview of Hack, also including quotes from Hack tech lead Julien Verlaguet.
Again, thanks to everyone who has created the information above, and to everyone who is already trying Hack. I’ve personally always been excited for what this technology could do to improve developers’ lives, and am looking forward to helping to grow the fledgling Hack community.
- Utomo: How about releasing tools to convert php script to hack? Or help popular opensource to migrate. Such as opencart
- Nino: Not that big yet, but not to forget: the german speaking hack and hhvm support forum. www.fbhack.de
- Florian Zemke: There's hackificator. On YouTube you will also find a presentation of some Facebookers who talk about migrating PHP to Hack.
- Josh Watzman: I actually wasn't aware of that one, thanks for pointing it out! I sadly don't speak German myself, but I'm pretty sure at least one member of our team does, so we'll make sure to have someone check it out.
- Josh Watzman: Indeed -- my presentation is on YouTube https://www.youtube.com/watch?v=5tEnAL_Fad4&list=PLb0IAmt7-GS2fdbb1vVdP8Z8zx1l2L8YS and the tools I talk about and demo are all available in the Debian packages, with the source code alongside Hack in the HHVM github repository. If you or anyone is running into any problems, please let us know! For bugs and problems, feel free to file an issue on github. For general questions, we monitor the "hacklang" StackOverflow tag, and members of the Hack team are also typically on IRC (#hhvm on Freenode) during the workday US Pacific time.
- Adrian Budau: Would you consider added polling to hh_server next to inotify? Virtualbox shared folders don't trigger inotify notifications properly so this would be very useful :-)
- speg: Is this why I have to manually restart and do hh_client check each time?
- Josh Watzman: This is something we're considering, yes. For now, you may want to try http://docs.vagrantup.com/v2/synced-folders/rsync.html -- it will hopefully generate the right inotify events and fix the problem, though I haven't tried it personally. (You can also move your code out of the VirtualBox share.) If you want a one-shot batch mode, we do have an implementation of that -- you can run "hh_server --check path/to/www/dir" Are you using VirtualBox for any inherent reason, or are you on an unsupported OS and just need it to get Linux running? What OS are you using? We're trying to prioritize building a "less smart" incremental mode vs. proper OS X support. (Windows will come somewhat later and is more involved.)
- Josh Watzman: Very likely, yes, sorry about that. See my response to the parent comment for some other things you can do.
- Adrian Budau: I tried using rsync. With auto-sync it works more or less reliably (if you run scripts that modify a large number of files auto-sync is slow sometimes). I use VirtualBox because at this moment it is still far more easier to set up hacklang on ubuntu than everything else. I am on OSX on the moment. +the ability to keep a project completely sandboxed.
- Adrian Budau: It seems I can't edit comments so I'll make anew one: I would not require this if hh_client and hh_server could be more easily installed (i.e. not require the whole of hhvm).
- speg: Thank you! I was so frustrated when I wasn't seeing the type checker catching my errors. I have confirmed that making changes inside my VM works. As does setting up the VM to sync with rsync. Though it's a bit awkward having to do the extra step of `vagrant rsync-auto`. I feel like I am missing something though.. Is hh_client supposed to alert your errors as soon as a change is detected? Right now I am having to do `hh_client` each time I want to check. If not, how is that any different thant the `hh_server --check path/to/www/dir` you mentioned earlier. I can't speak for the parent, but I am using vagrant & virtual box to manage development environments that are similar to production. I'm not sure having proper OS X support would help much, because I would still rather develop on a VM so that I could stay as close to production as possible.
- Nazar Mokrynskyi: I've looked video of talk about PHP -> Hack convertion. And I have a question about PhpDoc sections. As I understand - you ignore them, but most of code I write at least last year contains proper PhpDoc sections that you can definitely use during convertion. Do you have plans about supporting this at least as optional feature?
- Josh Watzman: Having hh_client/hh_server without HHVM isn't terribly useful, since you need HHVM to actually run your code! Or am I missing something about the use case you have in mind?
- Josh Watzman: Running hh_client is how you check for Hack errors. It just queries the server for the current error list, so if you want to run it automatically, you need to set that up yourself. There are a couple ways to get it to run automatically: - You can wire it in to your editor. We have vim support https://github.com/hhvm/vim-hack and emacs support https://github.com/facebook/hhvm/tree/master/hphp/hack/editor-plugins/emacs. This is pretty highly recommended. - You can run "watch hh_client" in a second terminal window.
- Josh Watzman: We don't plan to typecheck them as-is right now. Here is a long thread where I discuss our thoughts on different conversion strategies, including docblock comments: https://github.com/facebook/hhvm/issues/2236. (Short version: type-checking them isn't enforced by the runtime, which is dangerous.) Using them to aide a conversion effort is potentially useful. The challenge there is trying to parse the docblock comments, since everyone writes them slightly differently, and then get that into a format that makes sense in the Hack type system.
- Adrian Budau: I have hhvm installed in my VM (with all of its dependencies). That's where my server is set up. But I'm coding from my master OS (from outside). Here I don't need the whole power of HHVM, just the type checker. I hope was clear enough :-)