{"action":"created","comment":{"url":"https://api.github.com/repos/hhvm/user-documentation/pulls/comments/45297010","id":45297010,"diff_hunk":"@@ -1,79 +1,66 @@\n <?hh\n \n-// This double slash is a comment, just like PHP, C++, C#, etc. You can also\n-// use /* ... */ as well.\n-// All Hack programs start with <?hh\n-\n-// This namespace is here for purposes of keeping the examples in the\n-// documentation orderly. Bascically it is an organization tool for your code.\n-// So users of the class below that are not in the same namespace, will preface\n-// instantitations of the class with:\n-// Hack\\UserDocumentation\\Quickstart\\Examples\\First\\Complex\n namespace Hack\\UserDocumentation\\Quickstart\\Examples\\First;\n \n-// This is how you create a class in Hack\n-class Complex {\n-  // These are class properties. They can be public (totally accessible),\n-  // protected (this class and children), private (only this class).\n-  // They also have an optional type annotation; in this case, both members\n-  // are floating-point numbers.\n-  private float $real;\n-  private float $imag;\n+enum Food : string {\n+  VEGETABLE = \"Vegetable\";\n+  MEAT = \"Meat\";\n+}\n+\n+interface Animal {\n+  // You can eat and move at the same time so allow them to be async\n+  public function eat(Food $type): Awaitable<bool>;\n+  public function move(int $distance): Awaitable<void>;\n+\n+  // You cannot do anything else when you sleep, so it cannot be async\n+  public function sleep(): int;\n+}\n+\n+class Human implements Animal {\n+  private string $name;\n+\n+  public function __construct(string $name) {\n+    $this->name = $name;\n+  }\n+\n+  public async function eat(Food $type): Awaitable<(string, bool)> {\n+    // pretend this is the human eating time; usleep takes microseconds, so\n+    // 5000000 is 3 seconds\n+    await \\HH\\Asio\\usleep(3000000);","path":"guides/hack/01-getting-started/01-getting-started-examples/first.php","position":46,"original_position":46,"commit_id":"dcd5ccdccefc34a9deff8b4576aed83ea9a706c9","original_commit_id":"dcd5ccdccefc34a9deff8b4576aed83ea9a706c9","user":{"login":"JoelMarcey","id":3757713,"avatar_url":"https://avatars.githubusercontent.com/u/3757713?v=3","gravatar_id":"","url":"https://api.github.com/users/JoelMarcey","html_url":"https://github.com/JoelMarcey","followers_url":"https://api.github.com/users/JoelMarcey/followers","following_url":"https://api.github.com/users/JoelMarcey/following{/other_user}","gists_url":"https://api.github.com/users/JoelMarcey/gists{/gist_id}","starred_url":"https://api.github.com/users/JoelMarcey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JoelMarcey/subscriptions","organizations_url":"https://api.github.com/users/JoelMarcey/orgs","repos_url":"https://api.github.com/users/JoelMarcey/repos","events_url":"https://api.github.com/users/JoelMarcey/events{/privacy}","received_events_url":"https://api.github.com/users/JoelMarcey/received_events","type":"User","site_admin":false},"body":"Is there anything I can do here to make it so that `eat` and `move` are actually really `async`? Right now, they will always finish in 5 seconds, I think. Anyway to show that these two things can finish sooner? But still maintain simplicity. Do we need to? Does it matter?","created_at":"2015-11-19T03:55:02Z","updated_at":"2015-11-19T03:55:02Z","html_url":"https://github.com/hhvm/user-documentation/pull/111#discussion_r45297010","pull_request_url":"https://api.github.com/repos/hhvm/user-documentation/pulls/111","_links":{"self":{"href":"https://api.github.com/repos/hhvm/user-documentation/pulls/comments/45297010"},"html":{"href":"https://github.com/hhvm/user-documentation/pull/111#discussion_r45297010"},"pull_request":{"href":"https://api.github.com/repos/hhvm/user-documentation/pulls/111"}}},"pull_request":{"url":"https://api.github.com/repos/hhvm/user-documentation/pulls/111","id":51177162,"html_url":"https://github.com/hhvm/user-documentation/pull/111","diff_url":"https://github.com/hhvm/user-documentation/pull/111.diff","patch_url":"https://github.com/hhvm/user-documentation/pull/111.patch","issue_url":"https://api.github.com/repos/hhvm/user-documentation/issues/111","number":111,"state":"open","locked":false,"title":"Make the Hack getting started example more approachable","user":{"login":"JoelMarcey","id":3757713,"avatar_url":"https://avatars.githubusercontent.com/u/3757713?v=3","gravatar_id":"","url":"https://api.github.com/users/JoelMarcey","html_url":"https://github.com/JoelMarcey","followers_url":"https://api.github.com/users/JoelMarcey/followers","following_url":"https://api.github.com/users/JoelMarcey/following{/other_user}","gists_url":"https://api.github.com/users/JoelMarcey/gists{/gist_id}","starred_url":"https://api.github.com/users/JoelMarcey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JoelMarcey/subscriptions","organizations_url":"https://api.github.com/users/JoelMarcey/orgs","repos_url":"https://api.github.com/users/JoelMarcey/repos","events_url":"https://api.github.com/users/JoelMarcey/events{/privacy}","received_events_url":"https://api.github.com/users/JoelMarcey/received_events","type":"User","site_admin":false},"body":"We had `Complex` before. Let's use something like `Animal` and\r\n`Human` to be more relevant to someone new. Use `async` on things\r\na Human might be able to task switch on (e.g., walk and chew gum).\r\nThose sort of things.\r\n\r\nFixes #37","created_at":"2015-11-19T03:52:21Z","updated_at":"2015-11-19T03:55:02Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5f934f02f17fbb6752e99308a3ad40ebf540a8e6","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/hhvm/user-documentation/pulls/111/commits","review_comments_url":"https://api.github.com/repos/hhvm/user-documentation/pulls/111/comments","review_comment_url":"https://api.github.com/repos/hhvm/user-documentation/pulls/comments{/number}","comments_url":"https://api.github.com/repos/hhvm/user-documentation/issues/111/comments","statuses_url":"https://api.github.com/repos/hhvm/user-documentation/statuses/dcd5ccdccefc34a9deff8b4576aed83ea9a706c9","head":{"label":"hhvm:hack-getting-started-example","ref":"hack-getting-started-example","sha":"dcd5ccdccefc34a9deff8b4576aed83ea9a706c9","user":{"login":"hhvm","id":4553654,"avatar_url":"https://avatars.githubusercontent.com/u/4553654?v=3","gravatar_id":"","url":"https://api.github.com/users/hhvm","html_url":"https://github.com/hhvm","followers_url":"https://api.github.com/users/hhvm/followers","following_url":"https://api.github.com/users/hhvm/following{/other_user}","gists_url":"https://api.github.com/users/hhvm/gists{/gist_id}","starred_url":"https://api.github.com/users/hhvm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hhvm/subscriptions","organizations_url":"https://api.github.com/users/hhvm/orgs","repos_url":"https://api.github.com/users/hhvm/repos","events_url":"https://api.github.com/users/hhvm/events{/privacy}","received_events_url":"https://api.github.com/users/hhvm/received_events","type":"Organization","site_admin":false},"repo":{"id":39790753,"name":"user-documentation","full_name":"hhvm/user-documentation","owner":{"login":"hhvm","id":4553654,"avatar_url":"https://avatars.githubusercontent.com/u/4553654?v=3","gravatar_id":"","url":"https://api.github.com/users/hhvm","html_url":"https://github.com/hhvm","followers_url":"https://api.github.com/users/hhvm/followers","following_url":"https://api.github.com/users/hhvm/following{/other_user}","gists_url":"https://api.github.com/users/hhvm/gists{/gist_id}","starred_url":"https://api.github.com/users/hhvm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hhvm/subscriptions","organizations_url":"https://api.github.com/users/hhvm/orgs","repos_url":"https://api.github.com/users/hhvm/repos","events_url":"https://api.github.com/users/hhvm/events{/privacy}","received_events_url":"https://api.github.com/users/hhvm/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/hhvm/user-documentation","description":"Documentation for those that use HHVM and write Hack and PHP code for HHVM.","fork":false,"url":"https://api.github.com/repos/hhvm/user-documentation","forks_url":"https://api.github.com/repos/hhvm/user-documentation/forks","keys_url":"https://api.github.com/repos/hhvm/user-documentation/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hhvm/user-documentation/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hhvm/user-documentation/teams","hooks_url":"https://api.github.com/repos/hhvm/user-documentation/hooks","issue_events_url":"https://api.github.com/repos/hhvm/user-documentation/issues/events{/number}","events_url":"https://api.github.com/repos/hhvm/user-documentation/events","assignees_url":"https://api.github.com/repos/hhvm/user-documentation/assignees{/user}","branches_url":"https://api.github.com/repos/hhvm/user-documentation/branches{/branch}","tags_url":"https://api.github.com/repos/hhvm/user-documentation/tags","blobs_url":"https://api.github.com/repos/hhvm/user-documentation/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hhvm/user-documentation/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hhvm/user-documentation/git/refs{/sha}","trees_url":"https://api.github.com/repos/hhvm/user-documentation/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hhvm/user-documentation/statuses/{sha}","languages_url":"https://api.github.com/repos/hhvm/user-documentation/languages","stargazers_url":"https://api.github.com/repos/hhvm/user-documentation/stargazers","contributors_url":"https://api.github.com/repos/hhvm/user-documentation/contributors","subscribers_url":"https://api.github.com/repos/hhvm/user-documentation/subscribers","subscription_url":"https://api.github.com/repos/hhvm/user-documentation/subscription","commits_url":"https://api.github.com/repos/hhvm/user-documentation/commits{/sha}","git_commits_url":"https://api.github.com/repos/hhvm/user-documentation/git/commits{/sha}","comments_url":"https://api.github.com/repos/hhvm/user-documentation/comments{/number}","issue_comment_url":"https://api.github.com/repos/hhvm/user-documentation/issues/comments{/number}","contents_url":"https://api.github.com/repos/hhvm/user-documentation/contents/{+path}","compare_url":"https://api.github.com/repos/hhvm/user-documentation/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hhvm/user-documentation/merges","archive_url":"https://api.github.com/repos/hhvm/user-documentation/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hhvm/user-documentation/downloads","issues_url":"https://api.github.com/repos/hhvm/user-documentation/issues{/number}","pulls_url":"https://api.github.com/repos/hhvm/user-documentation/pulls{/number}","milestones_url":"https://api.github.com/repos/hhvm/user-documentation/milestones{/number}","notifications_url":"https://api.github.com/repos/hhvm/user-documentation/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hhvm/user-documentation/labels{/name}","releases_url":"https://api.github.com/repos/hhvm/user-documentation/releases{/id}","created_at":"2015-07-27T18:24:58Z","updated_at":"2015-11-18T02:06:45Z","pushed_at":"2015-11-19T03:52:21Z","git_url":"git://github.com/hhvm/user-documentation.git","ssh_url":"git@github.com:hhvm/user-documentation.git","clone_url":"https://github.com/hhvm/user-documentation.git","svn_url":"https://github.com/hhvm/user-documentation","homepage":null,"size":4535,"stargazers_count":7,"watchers_count":7,"language":"Hack","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":16,"mirror_url":null,"open_issues_count":19,"forks":16,"open_issues":19,"watchers":7,"default_branch":"master"}},"base":{"label":"hhvm:master","ref":"master","sha":"c7f92244f9844f9d0565d1e3d9f735b74b3e2589","user":{"login":"hhvm","id":4553654,"avatar_url":"https://avatars.githubusercontent.com/u/4553654?v=3","gravatar_id":"","url":"https://api.github.com/users/hhvm","html_url":"https://github.com/hhvm","followers_url":"https://api.github.com/users/hhvm/followers","following_url":"https://api.github.com/users/hhvm/following{/other_user}","gists_url":"https://api.github.com/users/hhvm/gists{/gist_id}","starred_url":"https://api.github.com/users/hhvm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hhvm/subscriptions","organizations_url":"https://api.github.com/users/hhvm/orgs","repos_url":"https://api.github.com/users/hhvm/repos","events_url":"https://api.github.com/users/hhvm/events{/privacy}","received_events_url":"https://api.github.com/users/hhvm/received_events","type":"Organization","site_admin":false},"repo":{"id":39790753,"name":"user-documentation","full_name":"hhvm/user-documentation","owner":{"login":"hhvm","id":4553654,"avatar_url":"https://avatars.githubusercontent.com/u/4553654?v=3","gravatar_id":"","url":"https://api.github.com/users/hhvm","html_url":"https://github.com/hhvm","followers_url":"https://api.github.com/users/hhvm/followers","following_url":"https://api.github.com/users/hhvm/following{/other_user}","gists_url":"https://api.github.com/users/hhvm/gists{/gist_id}","starred_url":"https://api.github.com/users/hhvm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hhvm/subscriptions","organizations_url":"https://api.github.com/users/hhvm/orgs","repos_url":"https://api.github.com/users/hhvm/repos","events_url":"https://api.github.com/users/hhvm/events{/privacy}","received_events_url":"https://api.github.com/users/hhvm/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/hhvm/user-documentation","description":"Documentation for those that use HHVM and write Hack and PHP code for HHVM.","fork":false,"url":"https://api.github.com/repos/hhvm/user-documentation","forks_url":"https://api.github.com/repos/hhvm/user-documentation/forks","keys_url":"https://api.github.com/repos/hhvm/user-documentation/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hhvm/user-documentation/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hhvm/user-documentation/teams","hooks_url":"https://api.github.com/repos/hhvm/user-documentation/hooks","issue_events_url":"https://api.github.com/repos/hhvm/user-documentation/issues/events{/number}","events_url":"https://api.github.com/repos/hhvm/user-documentation/events","assignees_url":"https://api.github.com/repos/hhvm/user-documentation/assignees{/user}","branches_url":"https://api.github.com/repos/hhvm/user-documentation/branches{/branch}","tags_url":"https://api.github.com/repos/hhvm/user-documentation/tags","blobs_url":"https://api.github.com/repos/hhvm/user-documentation/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hhvm/user-documentation/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hhvm/user-documentation/git/refs{/sha}","trees_url":"https://api.github.com/repos/hhvm/user-documentation/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hhvm/user-documentation/statuses/{sha}","languages_url":"https://api.github.com/repos/hhvm/user-documentation/languages","stargazers_url":"https://api.github.com/repos/hhvm/user-documentation/stargazers","contributors_url":"https://api.github.com/repos/hhvm/user-documentation/contributors","subscribers_url":"https://api.github.com/repos/hhvm/user-documentation/subscribers","subscription_url":"https://api.github.com/repos/hhvm/user-documentation/subscription","commits_url":"https://api.github.com/repos/hhvm/user-documentation/commits{/sha}","git_commits_url":"https://api.github.com/repos/hhvm/user-documentation/git/commits{/sha}","comments_url":"https://api.github.com/repos/hhvm/user-documentation/comments{/number}","issue_comment_url":"https://api.github.com/repos/hhvm/user-documentation/issues/comments{/number}","contents_url":"https://api.github.com/repos/hhvm/user-documentation/contents/{+path}","compare_url":"https://api.github.com/repos/hhvm/user-documentation/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hhvm/user-documentation/merges","archive_url":"https://api.github.com/repos/hhvm/user-documentation/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hhvm/user-documentation/downloads","issues_url":"https://api.github.com/repos/hhvm/user-documentation/issues{/number}","pulls_url":"https://api.github.com/repos/hhvm/user-documentation/pulls{/number}","milestones_url":"https://api.github.com/repos/hhvm/user-documentation/milestones{/number}","notifications_url":"https://api.github.com/repos/hhvm/user-documentation/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hhvm/user-documentation/labels{/name}","releases_url":"https://api.github.com/repos/hhvm/user-documentation/releases{/id}","created_at":"2015-07-27T18:24:58Z","updated_at":"2015-11-18T02:06:45Z","pushed_at":"2015-11-19T03:52:21Z","git_url":"git://github.com/hhvm/user-documentation.git","ssh_url":"git@github.com:hhvm/user-documentation.git","clone_url":"https://github.com/hhvm/user-documentation.git","svn_url":"https://github.com/hhvm/user-documentation","homepage":null,"size":4535,"stargazers_count":7,"watchers_count":7,"language":"Hack","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":16,"mirror_url":null,"open_issues_count":19,"forks":16,"open_issues":19,"watchers":7,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/hhvm/user-documentation/pulls/111"},"html":{"href":"https://github.com/hhvm/user-documentation/pull/111"},"issue":{"href":"https://api.github.com/repos/hhvm/user-documentation/issues/111"},"comments":{"href":"https://api.github.com/repos/hhvm/user-documentation/issues/111/comments"},"review_comments":{"href":"https://api.github.com/repos/hhvm/user-documentation/pulls/111/comments"},"review_comment":{"href":"https://api.github.com/repos/hhvm/user-documentation/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/hhvm/user-documentation/pulls/111/commits"},"statuses":{"href":"https://api.github.com/repos/hhvm/user-documentation/statuses/dcd5ccdccefc34a9deff8b4576aed83ea9a706c9"}}}}