{"action":"created","comment":{"url":"https://api.github.com/repos/p4lang/p4-spec/pulls/comments/191017824","pull_request_review_id":123522905,"id":191017824,"diff_hunk":"@@ -3819,6 +3820,33 @@ table tbl {\n }\n ~ End P4Example\n \n+# Function declarations { #sec-functions }\n+\n+Functions can be declared only at the top-level.  Functions are very\n+similar to functions in languages such as C or Java.  However, P4 does\n+not permit recursive functions.\n+\n+~ Begin P4Grammar\n+functionDeclaration\n+    : functionPrototype blockStatement\n+    ;\n+~ End P4Grammar\n+\n+Here is an example of a function that returns the maximum of two 32-bit values:\n+\n+~ Begin P4Example\n+bit<32> max(in bit<32> left, in bit<32> right) {","path":"p4-16/spec/P4-16-spec.mdk","position":36,"original_position":36,"commit_id":"3c4fa1f041c9a2c88d2a5534e8bce5377e020b83","original_commit_id":"3c4fa1f041c9a2c88d2a5534e8bce5377e020b83","user":{"login":"mbudiu-vmw","id":19397042,"avatar_url":"https://avatars1.githubusercontent.com/u/19397042?v=4","gravatar_id":"","url":"https://api.github.com/users/mbudiu-vmw","html_url":"https://github.com/mbudiu-vmw","followers_url":"https://api.github.com/users/mbudiu-vmw/followers","following_url":"https://api.github.com/users/mbudiu-vmw/following{/other_user}","gists_url":"https://api.github.com/users/mbudiu-vmw/gists{/gist_id}","starred_url":"https://api.github.com/users/mbudiu-vmw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mbudiu-vmw/subscriptions","organizations_url":"https://api.github.com/users/mbudiu-vmw/orgs","repos_url":"https://api.github.com/users/mbudiu-vmw/repos","events_url":"https://api.github.com/users/mbudiu-vmw/events{/privacy}","received_events_url":"https://api.github.com/users/mbudiu-vmw/received_events","type":"User","site_admin":false},"body":"yes, but that is part of the other spec PR, with the named arguments.\r\nThat will clarify the overloading rules.\r\nAnd currently there are no optional arguments at all in the spec.","created_at":"2018-05-25T21:56:55Z","updated_at":"2018-05-25T21:56:55Z","html_url":"https://github.com/p4lang/p4-spec/pull/624#discussion_r191017824","pull_request_url":"https://api.github.com/repos/p4lang/p4-spec/pulls/624","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/p4lang/p4-spec/pulls/comments/191017824"},"html":{"href":"https://github.com/p4lang/p4-spec/pull/624#discussion_r191017824"},"pull_request":{"href":"https://api.github.com/repos/p4lang/p4-spec/pulls/624"}},"in_reply_to_id":191017577},"pull_request":{"url":"https://api.github.com/repos/p4lang/p4-spec/pulls/624","id":188593971,"html_url":"https://github.com/p4lang/p4-spec/pull/624","diff_url":"https://github.com/p4lang/p4-spec/pull/624.diff","patch_url":"https://github.com/p4lang/p4-spec/pull/624.patch","issue_url":"https://api.github.com/repos/p4lang/p4-spec/issues/624","number":624,"state":"open","locked":false,"title":"Added specification for function declarations","user":{"login":"mbudiu-vmw","id":19397042,"avatar_url":"https://avatars1.githubusercontent.com/u/19397042?v=4","gravatar_id":"","url":"https://api.github.com/users/mbudiu-vmw","html_url":"https://github.com/mbudiu-vmw","followers_url":"https://api.github.com/users/mbudiu-vmw/followers","following_url":"https://api.github.com/users/mbudiu-vmw/following{/other_user}","gists_url":"https://api.github.com/users/mbudiu-vmw/gists{/gist_id}","starred_url":"https://api.github.com/users/mbudiu-vmw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mbudiu-vmw/subscriptions","organizations_url":"https://api.github.com/users/mbudiu-vmw/orgs","repos_url":"https://api.github.com/users/mbudiu-vmw/repos","events_url":"https://api.github.com/users/mbudiu-vmw/events{/privacy}","received_events_url":"https://api.github.com/users/mbudiu-vmw/received_events","type":"User","site_admin":false},"body":"It turns out this is quite easy to write in the spec. The implementation will take a bit of work, but not too much.","created_at":"2018-05-17T00:19:20Z","updated_at":"2018-05-25T21:56:55Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c19ae0c8f463815deff350a8a219dacedef2114b","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/p4lang/p4-spec/pulls/624/commits","review_comments_url":"https://api.github.com/repos/p4lang/p4-spec/pulls/624/comments","review_comment_url":"https://api.github.com/repos/p4lang/p4-spec/pulls/comments{/number}","comments_url":"https://api.github.com/repos/p4lang/p4-spec/issues/624/comments","statuses_url":"https://api.github.com/repos/p4lang/p4-spec/statuses/3c4fa1f041c9a2c88d2a5534e8bce5377e020b83","head":{"label":"p4lang:function","ref":"function","sha":"3c4fa1f041c9a2c88d2a5534e8bce5377e020b83","user":{"login":"p4lang","id":10765181,"avatar_url":"https://avatars1.githubusercontent.com/u/10765181?v=4","gravatar_id":"","url":"https://api.github.com/users/p4lang","html_url":"https://github.com/p4lang","followers_url":"https://api.github.com/users/p4lang/followers","following_url":"https://api.github.com/users/p4lang/following{/other_user}","gists_url":"https://api.github.com/users/p4lang/gists{/gist_id}","starred_url":"https://api.github.com/users/p4lang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/p4lang/subscriptions","organizations_url":"https://api.github.com/users/p4lang/orgs","repos_url":"https://api.github.com/users/p4lang/repos","events_url":"https://api.github.com/users/p4lang/events{/privacy}","received_events_url":"https://api.github.com/users/p4lang/received_events","type":"Organization","site_admin":false},"repo":{"id":40704988,"name":"p4-spec","full_name":"p4lang/p4-spec","owner":{"login":"p4lang","id":10765181,"avatar_url":"https://avatars1.githubusercontent.com/u/10765181?v=4","gravatar_id":"","url":"https://api.github.com/users/p4lang","html_url":"https://github.com/p4lang","followers_url":"https://api.github.com/users/p4lang/followers","following_url":"https://api.github.com/users/p4lang/following{/other_user}","gists_url":"https://api.github.com/users/p4lang/gists{/gist_id}","starred_url":"https://api.github.com/users/p4lang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/p4lang/subscriptions","organizations_url":"https://api.github.com/users/p4lang/orgs","repos_url":"https://api.github.com/users/p4lang/repos","events_url":"https://api.github.com/users/p4lang/events{/privacy}","received_events_url":"https://api.github.com/users/p4lang/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/p4lang/p4-spec","description":null,"fork":false,"url":"https://api.github.com/repos/p4lang/p4-spec","forks_url":"https://api.github.com/repos/p4lang/p4-spec/forks","keys_url":"https://api.github.com/repos/p4lang/p4-spec/keys{/key_id}","collaborators_url":"https://api.github.com/repos/p4lang/p4-spec/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/p4lang/p4-spec/teams","hooks_url":"https://api.github.com/repos/p4lang/p4-spec/hooks","issue_events_url":"https://api.github.com/repos/p4lang/p4-spec/issues/events{/number}","events_url":"https://api.github.com/repos/p4lang/p4-spec/events","assignees_url":"https://api.github.com/repos/p4lang/p4-spec/assignees{/user}","branches_url":"https://api.github.com/repos/p4lang/p4-spec/branches{/branch}","tags_url":"https://api.github.com/repos/p4lang/p4-spec/tags","blobs_url":"https://api.github.com/repos/p4lang/p4-spec/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/p4lang/p4-spec/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/p4lang/p4-spec/git/refs{/sha}","trees_url":"https://api.github.com/repos/p4lang/p4-spec/git/trees{/sha}","statuses_url":"https://api.github.com/repos/p4lang/p4-spec/statuses/{sha}","languages_url":"https://api.github.com/repos/p4lang/p4-spec/languages","stargazers_url":"https://api.github.com/repos/p4lang/p4-spec/stargazers","contributors_url":"https://api.github.com/repos/p4lang/p4-spec/contributors","subscribers_url":"https://api.github.com/repos/p4lang/p4-spec/subscribers","subscription_url":"https://api.github.com/repos/p4lang/p4-spec/subscription","commits_url":"https://api.github.com/repos/p4lang/p4-spec/commits{/sha}","git_commits_url":"https://api.github.com/repos/p4lang/p4-spec/git/commits{/sha}","comments_url":"https://api.github.com/repos/p4lang/p4-spec/comments{/number}","issue_comment_url":"https://api.github.com/repos/p4lang/p4-spec/issues/comments{/number}","contents_url":"https://api.github.com/repos/p4lang/p4-spec/contents/{+path}","compare_url":"https://api.github.com/repos/p4lang/p4-spec/compare/{base}...{head}","merges_url":"https://api.github.com/repos/p4lang/p4-spec/merges","archive_url":"https://api.github.com/repos/p4lang/p4-spec/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/p4lang/p4-spec/downloads","issues_url":"https://api.github.com/repos/p4lang/p4-spec/issues{/number}","pulls_url":"https://api.github.com/repos/p4lang/p4-spec/pulls{/number}","milestones_url":"https://api.github.com/repos/p4lang/p4-spec/milestones{/number}","notifications_url":"https://api.github.com/repos/p4lang/p4-spec/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/p4lang/p4-spec/labels{/name}","releases_url":"https://api.github.com/repos/p4lang/p4-spec/releases{/id}","deployments_url":"https://api.github.com/repos/p4lang/p4-spec/deployments","created_at":"2015-08-14T08:45:53Z","updated_at":"2018-05-25T16:39:46Z","pushed_at":"2018-05-25T16:43:20Z","git_url":"git://github.com/p4lang/p4-spec.git","ssh_url":"git@github.com:p4lang/p4-spec.git","clone_url":"https://github.com/p4lang/p4-spec.git","svn_url":"https://github.com/p4lang/p4-spec","homepage":null,"size":66142,"stargazers_count":37,"watchers_count":37,"language":"TeX","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":21,"mirror_url":null,"archived":false,"open_issues_count":74,"license":null,"forks":21,"open_issues":74,"watchers":37,"default_branch":"master"}},"base":{"label":"p4lang:master","ref":"master","sha":"18209e7e090a3ee1537e1b2ae063906834307eaf","user":{"login":"p4lang","id":10765181,"avatar_url":"https://avatars1.githubusercontent.com/u/10765181?v=4","gravatar_id":"","url":"https://api.github.com/users/p4lang","html_url":"https://github.com/p4lang","followers_url":"https://api.github.com/users/p4lang/followers","following_url":"https://api.github.com/users/p4lang/following{/other_user}","gists_url":"https://api.github.com/users/p4lang/gists{/gist_id}","starred_url":"https://api.github.com/users/p4lang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/p4lang/subscriptions","organizations_url":"https://api.github.com/users/p4lang/orgs","repos_url":"https://api.github.com/users/p4lang/repos","events_url":"https://api.github.com/users/p4lang/events{/privacy}","received_events_url":"https://api.github.com/users/p4lang/received_events","type":"Organization","site_admin":false},"repo":{"id":40704988,"name":"p4-spec","full_name":"p4lang/p4-spec","owner":{"login":"p4lang","id":10765181,"avatar_url":"https://avatars1.githubusercontent.com/u/10765181?v=4","gravatar_id":"","url":"https://api.github.com/users/p4lang","html_url":"https://github.com/p4lang","followers_url":"https://api.github.com/users/p4lang/followers","following_url":"https://api.github.com/users/p4lang/following{/other_user}","gists_url":"https://api.github.com/users/p4lang/gists{/gist_id}","starred_url":"https://api.github.com/users/p4lang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/p4lang/subscriptions","organizations_url":"https://api.github.com/users/p4lang/orgs","repos_url":"https://api.github.com/users/p4lang/repos","events_url":"https://api.github.com/users/p4lang/events{/privacy}","received_events_url":"https://api.github.com/users/p4lang/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/p4lang/p4-spec","description":null,"fork":false,"url":"https://api.github.com/repos/p4lang/p4-spec","forks_url":"https://api.github.com/repos/p4lang/p4-spec/forks","keys_url":"https://api.github.com/repos/p4lang/p4-spec/keys{/key_id}","collaborators_url":"https://api.github.com/repos/p4lang/p4-spec/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/p4lang/p4-spec/teams","hooks_url":"https://api.github.com/repos/p4lang/p4-spec/hooks","issue_events_url":"https://api.github.com/repos/p4lang/p4-spec/issues/events{/number}","events_url":"https://api.github.com/repos/p4lang/p4-spec/events","assignees_url":"https://api.github.com/repos/p4lang/p4-spec/assignees{/user}","branches_url":"https://api.github.com/repos/p4lang/p4-spec/branches{/branch}","tags_url":"https://api.github.com/repos/p4lang/p4-spec/tags","blobs_url":"https://api.github.com/repos/p4lang/p4-spec/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/p4lang/p4-spec/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/p4lang/p4-spec/git/refs{/sha}","trees_url":"https://api.github.com/repos/p4lang/p4-spec/git/trees{/sha}","statuses_url":"https://api.github.com/repos/p4lang/p4-spec/statuses/{sha}","languages_url":"https://api.github.com/repos/p4lang/p4-spec/languages","stargazers_url":"https://api.github.com/repos/p4lang/p4-spec/stargazers","contributors_url":"https://api.github.com/repos/p4lang/p4-spec/contributors","subscribers_url":"https://api.github.com/repos/p4lang/p4-spec/subscribers","subscription_url":"https://api.github.com/repos/p4lang/p4-spec/subscription","commits_url":"https://api.github.com/repos/p4lang/p4-spec/commits{/sha}","git_commits_url":"https://api.github.com/repos/p4lang/p4-spec/git/commits{/sha}","comments_url":"https://api.github.com/repos/p4lang/p4-spec/comments{/number}","issue_comment_url":"https://api.github.com/repos/p4lang/p4-spec/issues/comments{/number}","contents_url":"https://api.github.com/repos/p4lang/p4-spec/contents/{+path}","compare_url":"https://api.github.com/repos/p4lang/p4-spec/compare/{base}...{head}","merges_url":"https://api.github.com/repos/p4lang/p4-spec/merges","archive_url":"https://api.github.com/repos/p4lang/p4-spec/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/p4lang/p4-spec/downloads","issues_url":"https://api.github.com/repos/p4lang/p4-spec/issues{/number}","pulls_url":"https://api.github.com/repos/p4lang/p4-spec/pulls{/number}","milestones_url":"https://api.github.com/repos/p4lang/p4-spec/milestones{/number}","notifications_url":"https://api.github.com/repos/p4lang/p4-spec/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/p4lang/p4-spec/labels{/name}","releases_url":"https://api.github.com/repos/p4lang/p4-spec/releases{/id}","deployments_url":"https://api.github.com/repos/p4lang/p4-spec/deployments","created_at":"2015-08-14T08:45:53Z","updated_at":"2018-05-25T16:39:46Z","pushed_at":"2018-05-25T16:43:20Z","git_url":"git://github.com/p4lang/p4-spec.git","ssh_url":"git@github.com:p4lang/p4-spec.git","clone_url":"https://github.com/p4lang/p4-spec.git","svn_url":"https://github.com/p4lang/p4-spec","homepage":null,"size":66142,"stargazers_count":37,"watchers_count":37,"language":"TeX","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":21,"mirror_url":null,"archived":false,"open_issues_count":74,"license":null,"forks":21,"open_issues":74,"watchers":37,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/p4lang/p4-spec/pulls/624"},"html":{"href":"https://github.com/p4lang/p4-spec/pull/624"},"issue":{"href":"https://api.github.com/repos/p4lang/p4-spec/issues/624"},"comments":{"href":"https://api.github.com/repos/p4lang/p4-spec/issues/624/comments"},"review_comments":{"href":"https://api.github.com/repos/p4lang/p4-spec/pulls/624/comments"},"review_comment":{"href":"https://api.github.com/repos/p4lang/p4-spec/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/p4lang/p4-spec/pulls/624/commits"},"statuses":{"href":"https://api.github.com/repos/p4lang/p4-spec/statuses/3c4fa1f041c9a2c88d2a5534e8bce5377e020b83"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"mbudiu-vmw"}}