File: hack

package info (click to toggle)
ruby-rouge 4.6.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 6,836 kB
  • sloc: ruby: 38,168; sed: 2,071; perl: 152; makefile: 8
file content (27 lines) | stat: -rw-r--r-- 614 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<?hh // strict

// Unlike PHP, there's no top-level content (e.g. HTML) before `<?hh`, and `?>` is unsupported.

namespace Foo\Bar;

async function main(Vector<string> $argv): Awaitable<void> {
  var_dump($argv->map($x ==> 'Arg: '.$x."\n"));
}

// vec: new by-value container
// Vector: old by-ref (object semantics) container
async function wrap(vec<string> $argv): Awaitable<void> {
  await main(new Vector($argv));
}

function foo(int $x): string {
  // UNSAFE
  return $x;
}

function bar(int $x): string {
  return /* UNSAFE_EXPR */ $x;
}

/* HH_FIXME[1002] pseudomain in strict file */
HH\Asio\join(main());