{"action":"created","issue":{"url":"https://api.github.com/repos/ocaml/ocaml/issues/730","repository_url":"https://api.github.com/repos/ocaml/ocaml","labels_url":"https://api.github.com/repos/ocaml/ocaml/issues/730/labels{/name}","comments_url":"https://api.github.com/repos/ocaml/ocaml/issues/730/comments","events_url":"https://api.github.com/repos/ocaml/ocaml/issues/730/events","html_url":"https://github.com/ocaml/ocaml/pull/730","id":168534159,"number":730,"title":"Add an “unsafe” warning and annotation","user":{"login":"nbraud","id":1155801,"avatar_url":"https://avatars.githubusercontent.com/u/1155801?v=3","gravatar_id":"","url":"https://api.github.com/users/nbraud","html_url":"https://github.com/nbraud","followers_url":"https://api.github.com/users/nbraud/followers","following_url":"https://api.github.com/users/nbraud/following{/other_user}","gists_url":"https://api.github.com/users/nbraud/gists{/gist_id}","starred_url":"https://api.github.com/users/nbraud/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nbraud/subscriptions","organizations_url":"https://api.github.com/users/nbraud/orgs","repos_url":"https://api.github.com/users/nbraud/repos","events_url":"https://api.github.com/users/nbraud/events{/privacy}","received_events_url":"https://api.github.com/users/nbraud/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2016-07-31T19:35:39Z","updated_at":"2016-07-31T20:23:11Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/ocaml/ocaml/pulls/730","html_url":"https://github.com/ocaml/ocaml/pull/730","diff_url":"https://github.com/ocaml/ocaml/pull/730.diff","patch_url":"https://github.com/ocaml/ocaml/pull/730.patch"},"body":"This is a proposal for implementing an “unsafe” warning, similar to `deprecated`, as suggested by @alainfrisch in #724.\r\n\r\nDescription\r\n-----------\r\n\r\nWarning 62 (“unsafe”) is added, and triggers under the following conditions:\r\n\r\n- defining an `external`;\r\n- referencing a value or module that was tagged with `ocaml.unsafe`, as with `ocaml.deprecated`.\r\n\r\nThe implementation is very similar to the implementation of `ocaml.deprecated`, modulo some minor refactoring (calls to `Builtin_attributes.check_deprecated` were replaced by calls to `check_attr`, which simply calls both `check_deprecated` and the new `check_unsafe).\r\n\r\nSome minor changes were required in the stdlib, `Makefile`s and testsuite due to the pervasive use of `-warn-error A`.\r\n\r\n\r\nMotivation\r\n----------\r\n\r\nThere are two main reasons for implementing this:\r\n\r\n1. Enforcing the use of safe features  \r\n   This makes it very easy (by making this warning an error) to enforce that a certain codebase does not accidentaly use unsafe features, either through the stdlib (`Obj`, `Marshal`, `unsafe_*`) or by defining an `external`.\r\n2. Deterring users from using unsafe features  \r\n   Even outside of a codebase with an explicit policy regarding the use of unsafe features, a warning that is enabled by default will at least make the user aware of what they are doing, and hopefully consider safer/saner alternatives.\r\n\r\n\r\nNotes\r\n-----\r\n\r\nAs [mentionned by @mshinwell](https://github.com/ocaml/ocaml/pull/724#issuecomment-235887514), many libraries expose their own `external`s (with a sound type) in their API (which is useful in the context of bytecode execution). As such, this should only raise a warning at the definition point of the `external` (unless it is annotated with `ocaml.unsafe`)."},"comment":{"url":"https://api.github.com/repos/ocaml/ocaml/issues/comments/236454338","html_url":"https://github.com/ocaml/ocaml/pull/730#issuecomment-236454338","issue_url":"https://api.github.com/repos/ocaml/ocaml/issues/730","id":236454338,"user":{"login":"alainfrisch","id":3305274,"avatar_url":"https://avatars.githubusercontent.com/u/3305274?v=3","gravatar_id":"","url":"https://api.github.com/users/alainfrisch","html_url":"https://github.com/alainfrisch","followers_url":"https://api.github.com/users/alainfrisch/followers","following_url":"https://api.github.com/users/alainfrisch/following{/other_user}","gists_url":"https://api.github.com/users/alainfrisch/gists{/gist_id}","starred_url":"https://api.github.com/users/alainfrisch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alainfrisch/subscriptions","organizations_url":"https://api.github.com/users/alainfrisch/orgs","repos_url":"https://api.github.com/users/alainfrisch/repos","events_url":"https://api.github.com/users/alainfrisch/events{/privacy}","received_events_url":"https://api.github.com/users/alainfrisch/received_events","type":"User","site_admin":false},"created_at":"2016-07-31T20:23:11Z","updated_at":"2016-07-31T20:23:11Z","body":"I guess this is because stdlib is built with boot/ocamlc in a simple `make world`, while if you make `make opt`, it is built with the new ocamlc which has the new warning."}}
{"actor":{"display_login":"alainfrisch"}}