{"action":"created","issue":{"url":"https://api.github.com/repos/ocaml/ocaml/issues/1225","repository_url":"https://api.github.com/repos/ocaml/ocaml","labels_url":"https://api.github.com/repos/ocaml/ocaml/issues/1225/labels{/name}","comments_url":"https://api.github.com/repos/ocaml/ocaml/issues/1225/comments","events_url":"https://api.github.com/repos/ocaml/ocaml/issues/1225/events","html_url":"https://github.com/ocaml/ocaml/pull/1225","id":241015860,"number":1225,"title":"MPR#248: unique names for weak type variables","user":{"login":"Octachron","id":7689388,"avatar_url":"https://avatars2.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},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":7,"created_at":"2017-07-06T16:34:19Z","updated_at":"2017-07-13T14:14:43Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/ocaml/ocaml/pulls/1225","html_url":"https://github.com/ocaml/ocaml/pull/1225","diff_url":"https://github.com/ocaml/ocaml/pull/1225.diff","patch_url":"https://github.com/ocaml/ocaml/pull/1225.patch"},"body":"[MPR#248](https://caml.inria.fr/mantis/view.php?id=248):\r\nThis PR proposes to store separately the name given to weak type variable when printing them and to only forget those name once the associated weak type variable have been attributed a non weak type.\r\nWith this modification, in a given toplevel phrase or signature, each weak type variable is given an unique name. In other words, the types of\r\n```OCaml\r\nlet mk _ x = x\r\nlet f = mk ()\r\nlet g = mk ();;\r\nlet h = f;;\r\n```\r\nare printed with this PR as\r\n```OCaml\r\nval f:'_a ->'_a\r\nval g:'_b ->'_b (* and not '_a -> '_a as previously *)\r\nval h:'_a -> '_a\r\n ```\r\nand adding in the toplevel\r\n```OCaml\r\nlet x = f 1;;\r\nf;;\r\nlet i = mk ();;\r\n```\r\nyields\r\n```OCaml\r\nval x:int=1\r\nval f: int -> int\r\nval i: '_a -> '_a\r\n```\r\nNote that one disadvantage of remembering the names of weak type variables is that this deprives non weak type variables from using these names. Personally, I believe that adding a `w` prefix to the name of weak type varibles could favorably resolve this tension: the `_` prefix can be hard to see and replacing it with `_w` by convention would mitigate this issue. Another issue is that currently, the number of weak variable names kept in memory is unbounded. I am not sure if it can matter in practice.\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/ocaml/ocaml/issues/comments/315090558","html_url":"https://github.com/ocaml/ocaml/pull/1225#issuecomment-315090558","issue_url":"https://api.github.com/repos/ocaml/ocaml/issues/1225","id":315090558,"user":{"login":"Octachron","id":7689388,"avatar_url":"https://avatars2.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},"created_at":"2017-07-13T14:14:43Z","updated_at":"2017-07-13T14:14:43Z","body":"In this case, let's go for the searchable root name `weak` since I have the impression that weak type variable are rare enough that having a 6+ character-long names should be alright."}}
{"actor":{"display_login":"Octachron"}}