{"action":"opened","number":30,"pull_request":{"url":"https://api.github.com/repos/ocaml/ocamlbuild/pulls/30","id":54590107,"html_url":"https://github.com/ocaml/ocamlbuild/pull/30","diff_url":"https://github.com/ocaml/ocamlbuild/pull/30.diff","patch_url":"https://github.com/ocaml/ocamlbuild/pull/30.patch","issue_url":"https://api.github.com/repos/ocaml/ocamlbuild/issues/30","number":30,"state":"open","locked":false,"title":"[RFC] warn on second call to the dispatch function","user":{"login":"gasche","id":426238,"avatar_url":"https://avatars.githubusercontent.com/u/426238?v=3","gravatar_id":"","url":"https://api.github.com/users/gasche","html_url":"https://github.com/gasche","followers_url":"https://api.github.com/users/gasche/followers","following_url":"https://api.github.com/users/gasche/following{/other_user}","gists_url":"https://api.github.com/users/gasche/gists{/gist_id}","starred_url":"https://api.github.com/users/gasche/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gasche/subscriptions","organizations_url":"https://api.github.com/users/gasche/orgs","repos_url":"https://api.github.com/users/gasche/repos","events_url":"https://api.github.com/users/gasche/events{/privacy}","received_events_url":"https://api.github.com/users/gasche/received_events","type":"User","site_admin":false},"body":"It is an embarrassing shortcoming of the plugin-tags work that calling the `dispatch` function several times just silently overrides its behaviour. Forcing users to call `dispatch` exactly once may be the right interface to expose, but not saying anything if they make a mistake is bad usability.\r\n\r\nOne approach would be to keep a queue of hooks, push each new hook, and call them in order at dispatch time. I decided *not* to do that, however, because that would encourage an imperative way to provide functionality, with each plugin doing its own `dispatch` call; this would be fairly fragile as (1) users would have little control over the ordering on plugin rules and (2) they would have to jump through hoops to make sure the plugins are really linked, otherwise their effect would get silently dropped.\r\n\r\nBy forcing that there is at most one dispatch call, we in fact enforce a pure, declarative interface between plugin providers and plugin users. This has worked out rather well in practice (despite the subpar usability of the current code), see [js_of_ocaml ocamlbuild plugin](https://ocsigen.org/js_of_ocaml/api/Ocamlbuild_js_of_ocaml) for example.\r\n\r\nThis PR keeps this current interface of having a single dispatch call, but adds a warning each time a previously installed hook is discarded. (The formatted warning text is rather painful to read, so I will probably convert it to one of Daniel's Bünzli nice formatting functions instead.)","created_at":"2015-12-25T16:08:24Z","updated_at":"2015-12-25T16:08:24Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/ocaml/ocamlbuild/pulls/30/commits","review_comments_url":"https://api.github.com/repos/ocaml/ocamlbuild/pulls/30/comments","review_comment_url":"https://api.github.com/repos/ocaml/ocamlbuild/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ocaml/ocamlbuild/issues/30/comments","statuses_url":"https://api.github.com/repos/ocaml/ocamlbuild/statuses/ddc8ed58de4fbc7c791f4cdce2fb069309bad37c","head":{"label":"gasche:no-double-dispatch","ref":"no-double-dispatch","sha":"ddc8ed58de4fbc7c791f4cdce2fb069309bad37c","user":{"login":"gasche","id":426238,"avatar_url":"https://avatars.githubusercontent.com/u/426238?v=3","gravatar_id":"","url":"https://api.github.com/users/gasche","html_url":"https://github.com/gasche","followers_url":"https://api.github.com/users/gasche/followers","following_url":"https://api.github.com/users/gasche/following{/other_user}","gists_url":"https://api.github.com/users/gasche/gists{/gist_id}","starred_url":"https://api.github.com/users/gasche/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gasche/subscriptions","organizations_url":"https://api.github.com/users/gasche/orgs","repos_url":"https://api.github.com/users/gasche/repos","events_url":"https://api.github.com/users/gasche/events{/privacy}","received_events_url":"https://api.github.com/users/gasche/received_events","type":"User","site_admin":false},"repo":{"id":48485337,"name":"ocamlbuild","full_name":"gasche/ocamlbuild","owner":{"login":"gasche","id":426238,"avatar_url":"https://avatars.githubusercontent.com/u/426238?v=3","gravatar_id":"","url":"https://api.github.com/users/gasche","html_url":"https://github.com/gasche","followers_url":"https://api.github.com/users/gasche/followers","following_url":"https://api.github.com/users/gasche/following{/other_user}","gists_url":"https://api.github.com/users/gasche/gists{/gist_id}","starred_url":"https://api.github.com/users/gasche/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gasche/subscriptions","organizations_url":"https://api.github.com/users/gasche/orgs","repos_url":"https://api.github.com/users/gasche/repos","events_url":"https://api.github.com/users/gasche/events{/privacy}","received_events_url":"https://api.github.com/users/gasche/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/gasche/ocamlbuild","description":"OCamlbuild","fork":true,"url":"https://api.github.com/repos/gasche/ocamlbuild","forks_url":"https://api.github.com/repos/gasche/ocamlbuild/forks","keys_url":"https://api.github.com/repos/gasche/ocamlbuild/keys{/key_id}","collaborators_url":"https://api.github.com/repos/gasche/ocamlbuild/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/gasche/ocamlbuild/teams","hooks_url":"https://api.github.com/repos/gasche/ocamlbuild/hooks","issue_events_url":"https://api.github.com/repos/gasche/ocamlbuild/issues/events{/number}","events_url":"https://api.github.com/repos/gasche/ocamlbuild/events","assignees_url":"https://api.github.com/repos/gasche/ocamlbuild/assignees{/user}","branches_url":"https://api.github.com/repos/gasche/ocamlbuild/branches{/branch}","tags_url":"https://api.github.com/repos/gasche/ocamlbuild/tags","blobs_url":"https://api.github.com/repos/gasche/ocamlbuild/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/gasche/ocamlbuild/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/gasche/ocamlbuild/git/refs{/sha}","trees_url":"https://api.github.com/repos/gasche/ocamlbuild/git/trees{/sha}","statuses_url":"https://api.github.com/repos/gasche/ocamlbuild/statuses/{sha}","languages_url":"https://api.github.com/repos/gasche/ocamlbuild/languages","stargazers_url":"https://api.github.com/repos/gasche/ocamlbuild/stargazers","contributors_url":"https://api.github.com/repos/gasche/ocamlbuild/contributors","subscribers_url":"https://api.github.com/repos/gasche/ocamlbuild/subscribers","subscription_url":"https://api.github.com/repos/gasche/ocamlbuild/subscription","commits_url":"https://api.github.com/repos/gasche/ocamlbuild/commits{/sha}","git_commits_url":"https://api.github.com/repos/gasche/ocamlbuild/git/commits{/sha}","comments_url":"https://api.github.com/repos/gasche/ocamlbuild/comments{/number}","issue_comment_url":"https://api.github.com/repos/gasche/ocamlbuild/issues/comments{/number}","contents_url":"https://api.github.com/repos/gasche/ocamlbuild/contents/{+path}","compare_url":"https://api.github.com/repos/gasche/ocamlbuild/compare/{base}...{head}","merges_url":"https://api.github.com/repos/gasche/ocamlbuild/merges","archive_url":"https://api.github.com/repos/gasche/ocamlbuild/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/gasche/ocamlbuild/downloads","issues_url":"https://api.github.com/repos/gasche/ocamlbuild/issues{/number}","pulls_url":"https://api.github.com/repos/gasche/ocamlbuild/pulls{/number}","milestones_url":"https://api.github.com/repos/gasche/ocamlbuild/milestones{/number}","notifications_url":"https://api.github.com/repos/gasche/ocamlbuild/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/gasche/ocamlbuild/labels{/name}","releases_url":"https://api.github.com/repos/gasche/ocamlbuild/releases{/id}","created_at":"2015-12-23T10:44:18Z","updated_at":"2015-12-23T10:44:19Z","pushed_at":"2015-12-25T16:02:04Z","git_url":"git://github.com/gasche/ocamlbuild.git","ssh_url":"git@github.com:gasche/ocamlbuild.git","clone_url":"https://github.com/gasche/ocamlbuild.git","svn_url":"https://github.com/gasche/ocamlbuild","homepage":null,"size":780,"stargazers_count":0,"watchers_count":0,"language":"OCaml","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"ocaml:master","ref":"master","sha":"41710c6fc739a0cbdbd042ab7c05131c5b23dd6f","user":{"login":"ocaml","id":1841483,"avatar_url":"https://avatars.githubusercontent.com/u/1841483?v=3","gravatar_id":"","url":"https://api.github.com/users/ocaml","html_url":"https://github.com/ocaml","followers_url":"https://api.github.com/users/ocaml/followers","following_url":"https://api.github.com/users/ocaml/following{/other_user}","gists_url":"https://api.github.com/users/ocaml/gists{/gist_id}","starred_url":"https://api.github.com/users/ocaml/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ocaml/subscriptions","organizations_url":"https://api.github.com/users/ocaml/orgs","repos_url":"https://api.github.com/users/ocaml/repos","events_url":"https://api.github.com/users/ocaml/events{/privacy}","received_events_url":"https://api.github.com/users/ocaml/received_events","type":"Organization","site_admin":false},"repo":{"id":47338127,"name":"ocamlbuild","full_name":"ocaml/ocamlbuild","owner":{"login":"ocaml","id":1841483,"avatar_url":"https://avatars.githubusercontent.com/u/1841483?v=3","gravatar_id":"","url":"https://api.github.com/users/ocaml","html_url":"https://github.com/ocaml","followers_url":"https://api.github.com/users/ocaml/followers","following_url":"https://api.github.com/users/ocaml/following{/other_user}","gists_url":"https://api.github.com/users/ocaml/gists{/gist_id}","starred_url":"https://api.github.com/users/ocaml/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ocaml/subscriptions","organizations_url":"https://api.github.com/users/ocaml/orgs","repos_url":"https://api.github.com/users/ocaml/repos","events_url":"https://api.github.com/users/ocaml/events{/privacy}","received_events_url":"https://api.github.com/users/ocaml/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ocaml/ocamlbuild","description":"OCamlbuild","fork":false,"url":"https://api.github.com/repos/ocaml/ocamlbuild","forks_url":"https://api.github.com/repos/ocaml/ocamlbuild/forks","keys_url":"https://api.github.com/repos/ocaml/ocamlbuild/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ocaml/ocamlbuild/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ocaml/ocamlbuild/teams","hooks_url":"https://api.github.com/repos/ocaml/ocamlbuild/hooks","issue_events_url":"https://api.github.com/repos/ocaml/ocamlbuild/issues/events{/number}","events_url":"https://api.github.com/repos/ocaml/ocamlbuild/events","assignees_url":"https://api.github.com/repos/ocaml/ocamlbuild/assignees{/user}","branches_url":"https://api.github.com/repos/ocaml/ocamlbuild/branches{/branch}","tags_url":"https://api.github.com/repos/ocaml/ocamlbuild/tags","blobs_url":"https://api.github.com/repos/ocaml/ocamlbuild/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ocaml/ocamlbuild/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ocaml/ocamlbuild/git/refs{/sha}","trees_url":"https://api.github.com/repos/ocaml/ocamlbuild/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ocaml/ocamlbuild/statuses/{sha}","languages_url":"https://api.github.com/repos/ocaml/ocamlbuild/languages","stargazers_url":"https://api.github.com/repos/ocaml/ocamlbuild/stargazers","contributors_url":"https://api.github.com/repos/ocaml/ocamlbuild/contributors","subscribers_url":"https://api.github.com/repos/ocaml/ocamlbuild/subscribers","subscription_url":"https://api.github.com/repos/ocaml/ocamlbuild/subscription","commits_url":"https://api.github.com/repos/ocaml/ocamlbuild/commits{/sha}","git_commits_url":"https://api.github.com/repos/ocaml/ocamlbuild/git/commits{/sha}","comments_url":"https://api.github.com/repos/ocaml/ocamlbuild/comments{/number}","issue_comment_url":"https://api.github.com/repos/ocaml/ocamlbuild/issues/comments{/number}","contents_url":"https://api.github.com/repos/ocaml/ocamlbuild/contents/{+path}","compare_url":"https://api.github.com/repos/ocaml/ocamlbuild/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ocaml/ocamlbuild/merges","archive_url":"https://api.github.com/repos/ocaml/ocamlbuild/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ocaml/ocamlbuild/downloads","issues_url":"https://api.github.com/repos/ocaml/ocamlbuild/issues{/number}","pulls_url":"https://api.github.com/repos/ocaml/ocamlbuild/pulls{/number}","milestones_url":"https://api.github.com/repos/ocaml/ocamlbuild/milestones{/number}","notifications_url":"https://api.github.com/repos/ocaml/ocamlbuild/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ocaml/ocamlbuild/labels{/name}","releases_url":"https://api.github.com/repos/ocaml/ocamlbuild/releases{/id}","created_at":"2015-12-03T14:43:57Z","updated_at":"2015-12-24T00:34:19Z","pushed_at":"2015-12-25T00:20:19Z","git_url":"git://github.com/ocaml/ocamlbuild.git","ssh_url":"git@github.com:ocaml/ocamlbuild.git","clone_url":"https://github.com/ocaml/ocamlbuild.git","svn_url":"https://github.com/ocaml/ocamlbuild","homepage":null,"size":870,"stargazers_count":13,"watchers_count":13,"language":"OCaml","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":5,"mirror_url":null,"open_issues_count":27,"forks":5,"open_issues":27,"watchers":13,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ocaml/ocamlbuild/pulls/30"},"html":{"href":"https://github.com/ocaml/ocamlbuild/pull/30"},"issue":{"href":"https://api.github.com/repos/ocaml/ocamlbuild/issues/30"},"comments":{"href":"https://api.github.com/repos/ocaml/ocamlbuild/issues/30/comments"},"review_comments":{"href":"https://api.github.com/repos/ocaml/ocamlbuild/pulls/30/comments"},"review_comment":{"href":"https://api.github.com/repos/ocaml/ocamlbuild/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ocaml/ocamlbuild/pulls/30/commits"},"statuses":{"href":"https://api.github.com/repos/ocaml/ocamlbuild/statuses/ddc8ed58de4fbc7c791f4cdce2fb069309bad37c"}},"merged":false,"mergeable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"commits":1,"additions":18,"deletions":3,"changed_files":1}}