{"action":"created","issue":{"url":"https://api.github.com/repos/bloomberg/bucklescript/issues/282","repository_url":"https://api.github.com/repos/bloomberg/bucklescript","labels_url":"https://api.github.com/repos/bloomberg/bucklescript/issues/282/labels{/name}","comments_url":"https://api.github.com/repos/bloomberg/bucklescript/issues/282/comments","events_url":"https://api.github.com/repos/bloomberg/bucklescript/issues/282/events","html_url":"https://github.com/bloomberg/bucklescript/issues/282","id":150222962,"number":282,"title":"bs.scope broken","user":{"login":"copy","id":1816456,"avatar_url":"https://avatars.githubusercontent.com/u/1816456?v=3","gravatar_id":"","url":"https://api.github.com/users/copy","html_url":"https://github.com/copy","followers_url":"https://api.github.com/users/copy/followers","following_url":"https://api.github.com/users/copy/following{/other_user}","gists_url":"https://api.github.com/users/copy/gists{/gist_id}","starred_url":"https://api.github.com/users/copy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/copy/subscriptions","organizations_url":"https://api.github.com/users/copy/orgs","repos_url":"https://api.github.com/users/copy/repos","events_url":"https://api.github.com/users/copy/events{/privacy}","received_events_url":"https://api.github.com/users/copy/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/bloomberg/bucklescript/labels/bug","name":"bug","color":"fc2929"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2016-04-22T00:00:03Z","updated_at":"2016-04-22T17:55:52Z","closed_at":null,"body":"[This page](https://github.com/bloomberg/bucklescript/wiki/OCaml-call-JS) says \r\n\r\n```ocaml\r\nexternal dom : document = \"document\" [@@bs.val] [@@bs.scope \"window\"]\r\nlet f = dom\r\n```\r\n\r\nshould compile to\r\n\r\n```js\r\nvar f = window.document\r\n```\r\n\r\nbut it compiles to\r\n\r\n```js\r\nvar f = document;\r\n```"},"comment":{"url":"https://api.github.com/repos/bloomberg/bucklescript/issues/comments/213529639","html_url":"https://github.com/bloomberg/bucklescript/issues/282#issuecomment-213529639","issue_url":"https://api.github.com/repos/bloomberg/bucklescript/issues/282","id":213529639,"user":{"login":"bobzhang","id":747051,"avatar_url":"https://avatars.githubusercontent.com/u/747051?v=3","gravatar_id":"","url":"https://api.github.com/users/bobzhang","html_url":"https://github.com/bobzhang","followers_url":"https://api.github.com/users/bobzhang/followers","following_url":"https://api.github.com/users/bobzhang/following{/other_user}","gists_url":"https://api.github.com/users/bobzhang/gists{/gist_id}","starred_url":"https://api.github.com/users/bobzhang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bobzhang/subscriptions","organizations_url":"https://api.github.com/users/bobzhang/orgs","repos_url":"https://api.github.com/users/bobzhang/repos","events_url":"https://api.github.com/users/bobzhang/events{/privacy}","received_events_url":"https://api.github.com/users/bobzhang/received_events","type":"User","site_admin":false},"created_at":"2016-04-22T17:55:52Z","updated_at":"2016-04-22T17:55:52Z","body":"hi @copy, I feel `bs.scope` semantics is not very clear, I am thinking of get rid of it, does below work for you?\r\n\r\n```ocaml\r\ntype document                                                                                                                                                                                               \r\ntype element                                                                                                                                                                                                \r\nexternal doc : document = \"document\" [@@bs.val]                                                                                                                                                             \r\nexternal get_body : document -> element = \"body\" [@@bs.get]                                                                                                                                                 \r\n                                                                                                                                                                                                            \r\nlet v = doc |> get_body     \r\n```\r\n\r\nbtw, we will work on object FFI after the first release, so you can model it in an object style"}}