{"action":"created","issue":{"url":"https://api.github.com/repos/ocaml/ocaml/issues/885","repository_url":"https://api.github.com/repos/ocaml/ocaml","labels_url":"https://api.github.com/repos/ocaml/ocaml/issues/885/labels{/name}","comments_url":"https://api.github.com/repos/ocaml/ocaml/issues/885/comments","events_url":"https://api.github.com/repos/ocaml/ocaml/issues/885/events","html_url":"https://github.com/ocaml/ocaml/pull/885","id":186769765,"number":885,"title":"[WIP] Option-returning variants of stdlib functions","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},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-11-02T10:58:13Z","updated_at":"2016-11-02T11:09:49Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/ocaml/ocaml/pulls/885","html_url":"https://github.com/ocaml/ocaml/pull/885","diff_url":"https://github.com/ocaml/ocaml/pull/885.diff","patch_url":"https://github.com/ocaml/ocaml/pull/885.patch"},"body":"Stdlib uses exceptions ([Not_found], [Failure], [Invalid_argument]) to report non-exceptional conditions, such failed conversions from strings to numbers, or failing lookups in datastructures.  This is commonly thought as a design mistake (esp. because exceptions are not captured in types), and also has potentially bad performance consequences (allocating a [Some] block is usually faster than setting up an exception handler; and raising exception can be really slow when stacktraces are enabled).  Also, using exceptions can destroy previous stack traces if those functions are used within exception handlers.  Another arguments is that exceptions don't play very nicely with monadic abstraction libraries.\r\n\r\nConsidering how \"brittle\" exceptions are, it is best to have users explicitly use them if they want rather than have basic stdlib function raise them.\r\n\r\nThis PR adds option-returning variants of existing functions.  It does not attempt to cover all functions, since in particular [Failure]/[Invalid_argument] have arguably more legitimate uses (see commit messages for some more details on that).\r\n"},"comment":{"url":"https://api.github.com/repos/ocaml/ocaml/issues/comments/257835644","html_url":"https://github.com/ocaml/ocaml/pull/885#issuecomment-257835644","issue_url":"https://api.github.com/repos/ocaml/ocaml/issues/885","id":257835644,"user":{"login":"dra27","id":5250680,"avatar_url":"https://avatars.githubusercontent.com/u/5250680?v=3","gravatar_id":"","url":"https://api.github.com/users/dra27","html_url":"https://github.com/dra27","followers_url":"https://api.github.com/users/dra27/followers","following_url":"https://api.github.com/users/dra27/following{/other_user}","gists_url":"https://api.github.com/users/dra27/gists{/gist_id}","starred_url":"https://api.github.com/users/dra27/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dra27/subscriptions","organizations_url":"https://api.github.com/users/dra27/orgs","repos_url":"https://api.github.com/users/dra27/repos","events_url":"https://api.github.com/users/dra27/events{/privacy}","received_events_url":"https://api.github.com/users/dra27/received_events","type":"User","site_admin":false},"created_at":"2016-11-02T11:09:49Z","updated_at":"2016-11-02T11:09:49Z","body":"nativeint.ml, int32.ml and int64.ml should all have the TODO comment for different primitives (as in sys.mlp and pervasives.ml)"}}
{"actor":{"display_login":"dra27"}}