{"action":"created","comment":{"url":"https://api.github.com/repos/ocaml/ocaml/pulls/comments/44149041","id":44149041,"diff_hunk":"@@ -1340,13 +1340,16 @@ let apply env params body args =\n    quite pessimistic: it would be enough to flush the cache when a\n    type or module definition is overridden in the environnement.\n *)\n-let previous_env = ref Env.empty\n+\n+let previous_env_id = ref Env.(id empty)\n (*let string_of_kind = function Public -> \"public\" | Private -> \"private\"*)\n let check_abbrev_env env =\n-  if env != !previous_env then begin\n+  let id = Env.id env in\n+  let prev_id = !previous_env_id in\n+  if id != prev_id then begin","path":"typing/ctype.ml","position":null,"original_position":23,"commit_id":"31c8d4fd79036cd42dedb7518dd7f822d2c5cb28","original_commit_id":"a913f318e30ef5203c5640abf8b20e224850958c","user":{"login":"Octachron","id":7689388,"avatar_url":"https://avatars.githubusercontent.com/u/7689388?v=3","gravatar_id":"","url":"https://api.github.com/users/Octachron","html_url":"https://github.com/Octachron","followers_url":"https://api.github.com/users/Octachron/followers","following_url":"https://api.github.com/users/Octachron/following{/other_user}","gists_url":"https://api.github.com/users/Octachron/gists{/gist_id}","starred_url":"https://api.github.com/users/Octachron/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Octachron/subscriptions","organizations_url":"https://api.github.com/users/Octachron/orgs","repos_url":"https://api.github.com/users/Octachron/repos","events_url":"https://api.github.com/users/Octachron/events{/privacy}","received_events_url":"https://api.github.com/users/Octachron/received_events","type":"User","site_admin":false},"body":"Good point. Fixed.","created_at":"2015-11-06T15:35:24Z","updated_at":"2015-11-06T15:35:24Z","html_url":"https://github.com/ocaml/ocaml/pull/187#discussion_r44149041","pull_request_url":"https://api.github.com/repos/ocaml/ocaml/pulls/187","_links":{"self":{"href":"https://api.github.com/repos/ocaml/ocaml/pulls/comments/44149041"},"html":{"href":"https://github.com/ocaml/ocaml/pull/187#discussion_r44149041"},"pull_request":{"href":"https://api.github.com/repos/ocaml/ocaml/pulls/187"}}},"pull_request":{"url":"https://api.github.com/repos/ocaml/ocaml/pulls/187","id":36104968,"html_url":"https://github.com/ocaml/ocaml/pull/187","diff_url":"https://github.com/ocaml/ocaml/pull/187.diff","patch_url":"https://github.com/ocaml/ocaml/pull/187.patch","issue_url":"https://api.github.com/repos/ocaml/ocaml/issues/187","number":187,"state":"open","locked":false,"title":"Local open in patterns","user":{"login":"Octachron","id":7689388,"avatar_url":"https://avatars.githubusercontent.com/u/7689388?v=3","gravatar_id":"","url":"https://api.github.com/users/Octachron","html_url":"https://github.com/Octachron","followers_url":"https://api.github.com/users/Octachron/followers","following_url":"https://api.github.com/users/Octachron/following{/other_user}","gists_url":"https://api.github.com/users/Octachron/gists{/gist_id}","starred_url":"https://api.github.com/users/Octachron/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Octachron/subscriptions","organizations_url":"https://api.github.com/users/Octachron/orgs","repos_url":"https://api.github.com/users/Octachron/repos","events_url":"https://api.github.com/users/Octachron/events{/privacy}","received_events_url":"https://api.github.com/users/Octachron/received_events","type":"User","site_admin":false},"body":"This pull request adds support for local open inside patterns. Four new constructions mirroring the local open constructions for expressions are added\r\n\r\n  * `M.(pattern)`\r\n  * `M.[pattern_list]` ⟺ `M.([pattern_list])`\r\n  * `M.{labeled_pattern_list}` ⟺ `M.({labeled_pattern_list})`\r\n  * `M.[| .. |]` ⟺ `M.( [| .. |] )`\r\n\r\nAt the typing phase, the construction `M.(pattern)` brings all identifiers defined within M inside the scope and then proceed with the typing of `pattern`. All others expression are desugared to the `M.(..)` construction during parsing.\r\n\r\nOne the main advantages of these constructions would be to deconstruct record with the same\r\nsyntax used to construct them\r\n\r\n```Ocaml\r\nlet f M.{x} = M.{x}\r\n```\r\nOther uses of these local pattern might be quite unfrequent but the similarity with the local open for expression should help users to discover or remember this feature when the need arises. Since there is no analogous to `let open M in ...` on the pattern side, local open in pattern and expression are not completely symmetric. However, `let open M in ..` constructions in the pattern side would look quite foreign to me. \r\n\r\nQuestionable implementation details:\r\n  * Currently, the local pattern open use the `type_open` function like the local expression pattern. However, this implies that values defined inside `M` are also brought to the scope. Does this warrant a specialised `type_open_for_pattern` function?\r\n  * This pull request does not provide support for `M.()` and `M.[]` whose semantics seem quite ambiguous to me.","created_at":"2015-05-24T16:39:41Z","updated_at":"2015-11-06T15:35:24Z","closed_at":null,"merged_at":null,"merge_commit_sha":"74ba18bc8c75c48c6f4459be953f9f20f5dc8053","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/ocaml/ocaml/pulls/187/commits","review_comments_url":"https://api.github.com/repos/ocaml/ocaml/pulls/187/comments","review_comment_url":"https://api.github.com/repos/ocaml/ocaml/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ocaml/ocaml/issues/187/comments","statuses_url":"https://api.github.com/repos/ocaml/ocaml/statuses/31c8d4fd79036cd42dedb7518dd7f822d2c5cb28","head":{"label":"Octachron:pattern_open","ref":"pattern_open","sha":"31c8d4fd79036cd42dedb7518dd7f822d2c5cb28","user":{"login":"Octachron","id":7689388,"avatar_url":"https://avatars.githubusercontent.com/u/7689388?v=3","gravatar_id":"","url":"https://api.github.com/users/Octachron","html_url":"https://github.com/Octachron","followers_url":"https://api.github.com/users/Octachron/followers","following_url":"https://api.github.com/users/Octachron/following{/other_user}","gists_url":"https://api.github.com/users/Octachron/gists{/gist_id}","starred_url":"https://api.github.com/users/Octachron/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Octachron/subscriptions","organizations_url":"https://api.github.com/users/Octachron/orgs","repos_url":"https://api.github.com/users/Octachron/repos","events_url":"https://api.github.com/users/Octachron/events{/privacy}","received_events_url":"https://api.github.com/users/Octachron/received_events","type":"User","site_admin":false},"repo":{"id":20154083,"name":"ocaml","full_name":"Octachron/ocaml","owner":{"login":"Octachron","id":7689388,"avatar_url":"https://avatars.githubusercontent.com/u/7689388?v=3","gravatar_id":"","url":"https://api.github.com/users/Octachron","html_url":"https://github.com/Octachron","followers_url":"https://api.github.com/users/Octachron/followers","following_url":"https://api.github.com/users/Octachron/following{/other_user}","gists_url":"https://api.github.com/users/Octachron/gists{/gist_id}","starred_url":"https://api.github.com/users/Octachron/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Octachron/subscriptions","organizations_url":"https://api.github.com/users/Octachron/orgs","repos_url":"https://api.github.com/users/Octachron/repos","events_url":"https://api.github.com/users/Octachron/events{/privacy}","received_events_url":"https://api.github.com/users/Octachron/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Octachron/ocaml","description":"Read-only mirror of INRIA SVN","fork":true,"url":"https://api.github.com/repos/Octachron/ocaml","forks_url":"https://api.github.com/repos/Octachron/ocaml/forks","keys_url":"https://api.github.com/repos/Octachron/ocaml/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Octachron/ocaml/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Octachron/ocaml/teams","hooks_url":"https://api.github.com/repos/Octachron/ocaml/hooks","issue_events_url":"https://api.github.com/repos/Octachron/ocaml/issues/events{/number}","events_url":"https://api.github.com/repos/Octachron/ocaml/events","assignees_url":"https://api.github.com/repos/Octachron/ocaml/assignees{/user}","branches_url":"https://api.github.com/repos/Octachron/ocaml/branches{/branch}","tags_url":"https://api.github.com/repos/Octachron/ocaml/tags","blobs_url":"https://api.github.com/repos/Octachron/ocaml/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Octachron/ocaml/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Octachron/ocaml/git/refs{/sha}","trees_url":"https://api.github.com/repos/Octachron/ocaml/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Octachron/ocaml/statuses/{sha}","languages_url":"https://api.github.com/repos/Octachron/ocaml/languages","stargazers_url":"https://api.github.com/repos/Octachron/ocaml/stargazers","contributors_url":"https://api.github.com/repos/Octachron/ocaml/contributors","subscribers_url":"https://api.github.com/repos/Octachron/ocaml/subscribers","subscription_url":"https://api.github.com/repos/Octachron/ocaml/subscription","commits_url":"https://api.github.com/repos/Octachron/ocaml/commits{/sha}","git_commits_url":"https://api.github.com/repos/Octachron/ocaml/git/commits{/sha}","comments_url":"https://api.github.com/repos/Octachron/ocaml/comments{/number}","issue_comment_url":"https://api.github.com/repos/Octachron/ocaml/issues/comments{/number}","contents_url":"https://api.github.com/repos/Octachron/ocaml/contents/{+path}","compare_url":"https://api.github.com/repos/Octachron/ocaml/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Octachron/ocaml/merges","archive_url":"https://api.github.com/repos/Octachron/ocaml/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Octachron/ocaml/downloads","issues_url":"https://api.github.com/repos/Octachron/ocaml/issues{/number}","pulls_url":"https://api.github.com/repos/Octachron/ocaml/pulls{/number}","milestones_url":"https://api.github.com/repos/Octachron/ocaml/milestones{/number}","notifications_url":"https://api.github.com/repos/Octachron/ocaml/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Octachron/ocaml/labels{/name}","releases_url":"https://api.github.com/repos/Octachron/ocaml/releases{/id}","created_at":"2014-05-25T12:35:17Z","updated_at":"2015-04-23T12:04:07Z","pushed_at":"2015-11-06T15:31:55Z","git_url":"git://github.com/Octachron/ocaml.git","ssh_url":"git@github.com:Octachron/ocaml.git","clone_url":"https://github.com/Octachron/ocaml.git","svn_url":"https://github.com/Octachron/ocaml","homepage":null,"size":109860,"stargazers_count":0,"watchers_count":0,"language":"OCaml","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"trunk"}},"base":{"label":"ocaml:trunk","ref":"trunk","sha":"7cb9a80744aa47c1eb7bf4b1a32cfaf320fc8ef8","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":6786166,"name":"ocaml","full_name":"ocaml/ocaml","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/ocaml","description":"The core OCaml system: compilers, runtime system, base libraries","fork":false,"url":"https://api.github.com/repos/ocaml/ocaml","forks_url":"https://api.github.com/repos/ocaml/ocaml/forks","keys_url":"https://api.github.com/repos/ocaml/ocaml/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ocaml/ocaml/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ocaml/ocaml/teams","hooks_url":"https://api.github.com/repos/ocaml/ocaml/hooks","issue_events_url":"https://api.github.com/repos/ocaml/ocaml/issues/events{/number}","events_url":"https://api.github.com/repos/ocaml/ocaml/events","assignees_url":"https://api.github.com/repos/ocaml/ocaml/assignees{/user}","branches_url":"https://api.github.com/repos/ocaml/ocaml/branches{/branch}","tags_url":"https://api.github.com/repos/ocaml/ocaml/tags","blobs_url":"https://api.github.com/repos/ocaml/ocaml/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ocaml/ocaml/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ocaml/ocaml/git/refs{/sha}","trees_url":"https://api.github.com/repos/ocaml/ocaml/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ocaml/ocaml/statuses/{sha}","languages_url":"https://api.github.com/repos/ocaml/ocaml/languages","stargazers_url":"https://api.github.com/repos/ocaml/ocaml/stargazers","contributors_url":"https://api.github.com/repos/ocaml/ocaml/contributors","subscribers_url":"https://api.github.com/repos/ocaml/ocaml/subscribers","subscription_url":"https://api.github.com/repos/ocaml/ocaml/subscription","commits_url":"https://api.github.com/repos/ocaml/ocaml/commits{/sha}","git_commits_url":"https://api.github.com/repos/ocaml/ocaml/git/commits{/sha}","comments_url":"https://api.github.com/repos/ocaml/ocaml/comments{/number}","issue_comment_url":"https://api.github.com/repos/ocaml/ocaml/issues/comments{/number}","contents_url":"https://api.github.com/repos/ocaml/ocaml/contents/{+path}","compare_url":"https://api.github.com/repos/ocaml/ocaml/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ocaml/ocaml/merges","archive_url":"https://api.github.com/repos/ocaml/ocaml/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ocaml/ocaml/downloads","issues_url":"https://api.github.com/repos/ocaml/ocaml/issues{/number}","pulls_url":"https://api.github.com/repos/ocaml/ocaml/pulls{/number}","milestones_url":"https://api.github.com/repos/ocaml/ocaml/milestones{/number}","notifications_url":"https://api.github.com/repos/ocaml/ocaml/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ocaml/ocaml/labels{/name}","releases_url":"https://api.github.com/repos/ocaml/ocaml/releases{/id}","created_at":"2012-11-20T22:18:22Z","updated_at":"2015-11-06T12:42:22Z","pushed_at":"2015-11-06T15:31:56Z","git_url":"git://github.com/ocaml/ocaml.git","ssh_url":"git@github.com:ocaml/ocaml.git","clone_url":"https://github.com/ocaml/ocaml.git","svn_url":"https://github.com/ocaml/ocaml","homepage":"","size":172093,"stargazers_count":525,"watchers_count":525,"language":"OCaml","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":183,"mirror_url":null,"open_issues_count":76,"forks":183,"open_issues":76,"watchers":525,"default_branch":"trunk"}},"_links":{"self":{"href":"https://api.github.com/repos/ocaml/ocaml/pulls/187"},"html":{"href":"https://github.com/ocaml/ocaml/pull/187"},"issue":{"href":"https://api.github.com/repos/ocaml/ocaml/issues/187"},"comments":{"href":"https://api.github.com/repos/ocaml/ocaml/issues/187/comments"},"review_comments":{"href":"https://api.github.com/repos/ocaml/ocaml/pulls/187/comments"},"review_comment":{"href":"https://api.github.com/repos/ocaml/ocaml/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ocaml/ocaml/pulls/187/commits"},"statuses":{"href":"https://api.github.com/repos/ocaml/ocaml/statuses/31c8d4fd79036cd42dedb7518dd7f822d2c5cb28"}}}}