Skip to content

Instantly share code, notes, and snippets.

let frob1 x =
let y = x + 1 in
let z = y * x in
z + 2
let frob2 x =
let y = frob1 x in
y + 3
let main () =
<?hh
namespace NSTest;
class A {}
class C {
public static function foo<A>(A $x): A {
return $x;
}
<?hh
class Obj implements ArrayAccess<string, string> {
private array $container = array();
public function __construct() {
$this->container = array(
"one" => "alpha",
"two" => "beta",
"three" => "gamma",
);
}
<?hh
class Container implements ArrayAccess<string, string>
{
protected Map<string, string> $mappings;
public function __construct()
{
$this->mappings = Map {};
}
<?hh // strict
namespace Foo {
class :lala {}
}
namespace {
function f(): :lala {
return <lala />;
}
<?hh // strict
function f(): num {
if (true) {
return 1;
} else {
return 1.1;
}
}
==> cmake . -DBOOST_INCLUDEDIR=/Users/jwatzman/homebrew/opt/boost/include -DBOOST_LIBRARYDIR=/Users/jwatzman/homebrew/opt/boost/lib -DCCLIENT_INCLUDE_PATH=/Users/jwatzman/homebrew/opt/imap-uw/include/imap -DCMAKE_INCLUDE_PATH="/Users/jwatzman/homebrew/include:/usr/include" -DCMAKE_INSTALL_PREFIX=/Users/jwatzman/homebrew/Cellar/hhvm/3.2.1b -DCMAKE_LIBRARY_PATH="/Users/jwatzman/homebrew/lib:/usr/lib" -DCURL_INCLUDE_DIR=/Users/jwatzman/homebrew/opt/curl/include -DCURL_LIBRARY=/Users/jwatzman/homebrew/opt/curl/lib/libcurl.dylib -DFREETYPE_INCLUDE_DIRS=/Users/jwatzman/homebrew/opt/freetype/include/freetype2 -DFREETYPE_LIBRARIES=/Users/jwatzman/homebrew/opt/freetype/lib/libfreetype.dylib -DICU_DATA_LIBRARY=/Users/jwatzman/homebrew/opt/icu4c/lib/libicudata.dylib -DICU_I18N_LIBRARY=/Users/jwatzman/homebrew/opt/icu4c/lib/libicui18n.dylib -DICU_INCLUDE_DIR=/Users/jwatzman/homebrew/opt/icu4c/include -DICU_LIBRARY=/Users/jwatzman/homebrew/opt/icu4c/lib/libicuuc.dylib -DJEMALLOC_INCLUDE_DIR=/Users/jwatzman/homebrew/opt/je
==> Downloading https://github.com/facebook/hhvm/archive/5965dc9cac159bbd272e19d0a0da65fc83c16f5d.tar.gz
Already downloaded: /Library/Caches/Homebrew/hhvm-3.2.1b.tar.gz
==> Verifying hhvm-3.2.1b.tar.gz checksum
tar xf /Library/Caches/Homebrew/hhvm-3.2.1b.tar.gz
==> Patching
patching file hphp/runtime/base/emulate-zend.cpp
patching file hphp/runtime/base/program-functions.cpp
Hunk #1 succeeded at 1158 (offset 8 lines).
==> Downloading https://github.com/hhvm/hhvm-third-party/archive/937bd76f8913a84e21f7237fd0c38cf5596d176d.tar.gz
Already downloaded: /Library/Caches/Homebrew/hhvm--third-party-3.2.1b.tar.gz
[01:01P][jwatzman@jwatzman-mba:/tmp] $ cat foo.cpp
extern "C" void configure_link_extern_weak_test() __attribute__((weak));
int main(int argc, char** argv) {
return configure_link_extern_weak_test == nullptr;
}
[01:01P][jwatzman@jwatzman-mba:/tmp] $ g++-4.8 foo.cpp
foo.cpp: In function 'int main(int, char**)':
foo.cpp:3:44: error: 'nullptr' was not declared in this scope
return configure_link_extern_weak_test == nullptr;
^
@jwatzman
jwatzman / -
Created December 11, 2014 19:13
#!/usr/local/bin/python
def p(passnum, num):
return "$p%d_%d" % (passnum, num)
print """<?php
function f(&$x, &$y, $z) {
$x += $z;