Measures Concepts
GitHub icon

Hack

Hack - Programming language

< >

Hack is an open source programming language created in 2014 by Julien Verlaguet and Alok Menghrajani and Drew Paroski.

#154on PLDB 10Years Old 68kRepos

Try now: Riju

Hack is a programming language for the HipHop Virtual Machine (HHVM), created by Facebook as a dialect of PHP. The language implementation is open-source, licensed under the BSD License. Hack allows programmers to use both dynamic typing and static typing. Read more on Wikipedia...


Example from Riju:
<<__EntryPoint>> function main(): void { echo "Hello, world!\n"; }
Example from hello-world:
<?hh echo "Hello World";
<?hh // Hello world in Hack echo 'Hello World';
Example from Linguist:
<?hh // strict /** * Copyright (c) 2014, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * */ function startup(): void { setup_errors(); }
Example from Wikipedia:
<?hh // Hack functions are annotated with types. function negate(bool $x): bool { return !$x; }

Language features

Feature Supported Token Example
Strings ✓ "
"Hello world"
MultiLine Comments ✓ /* */
/* A comment
*/
Print() Debugging ✓ echo
Comments ✓
// A comment
Line Comments ✓ //
// A comment
First-Class Functions ✓
Semantic Indentation X

View source

- Build the next great programming language · Search · Add Language · Features · Creators · Resources · About · Blog · Acknowledgements · Queries · Stats · Sponsor · Day 605 · feedback@pldb.io · Logout