{"action":"created","issue":{"url":"https://api.github.com/repos/skulpt/skulpt/issues/484","labels_url":"https://api.github.com/repos/skulpt/skulpt/issues/484/labels{/name}","comments_url":"https://api.github.com/repos/skulpt/skulpt/issues/484/comments","events_url":"https://api.github.com/repos/skulpt/skulpt/issues/484/events","html_url":"https://github.com/skulpt/skulpt/pull/484","id":87129843,"number":484,"title":"Split Sk.builtin.nmber into Sk.builtin.int_ and Sk.builtin.float_","user":{"login":"mchat","id":4974085,"avatar_url":"https://avatars.githubusercontent.com/u/4974085?v=3","gravatar_id":"","url":"https://api.github.com/users/mchat","html_url":"https://github.com/mchat","followers_url":"https://api.github.com/users/mchat/followers","following_url":"https://api.github.com/users/mchat/following{/other_user}","gists_url":"https://api.github.com/users/mchat/gists{/gist_id}","starred_url":"https://api.github.com/users/mchat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mchat/subscriptions","organizations_url":"https://api.github.com/users/mchat/orgs","repos_url":"https://api.github.com/users/mchat/repos","events_url":"https://api.github.com/users/mchat/events{/privacy}","received_events_url":"https://api.github.com/users/mchat/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":{"login":"rixner","id":1915454,"avatar_url":"https://avatars.githubusercontent.com/u/1915454?v=3","gravatar_id":"","url":"https://api.github.com/users/rixner","html_url":"https://github.com/rixner","followers_url":"https://api.github.com/users/rixner/followers","following_url":"https://api.github.com/users/rixner/following{/other_user}","gists_url":"https://api.github.com/users/rixner/gists{/gist_id}","starred_url":"https://api.github.com/users/rixner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rixner/subscriptions","organizations_url":"https://api.github.com/users/rixner/orgs","repos_url":"https://api.github.com/users/rixner/repos","events_url":"https://api.github.com/users/rixner/events{/privacy}","received_events_url":"https://api.github.com/users/rixner/received_events","type":"User","site_admin":false},"milestone":null,"comments":20,"created_at":"2015-06-10T22:29:04Z","updated_at":"2015-06-17T15:33:30Z","closed_at":"2015-06-17T15:15:43Z","pull_request":{"url":"https://api.github.com/repos/skulpt/skulpt/pulls/484","html_url":"https://github.com/skulpt/skulpt/pull/484","diff_url":"https://github.com/skulpt/skulpt/pull/484.diff","patch_url":"https://github.com/skulpt/skulpt/pull/484.patch"},"body":"As per @bnmnetp's request, here is the first of several smaller pull requests.\r\n\r\nThis PR splits `Sk.builtin.nmber` into `Sk.builtin.int_` and `Sk.builtin.float_`. It builds on my initial work from #481 but works with the current state of Skulpt (aka no Javascript inheritance in the builtins). I also did some extra work to track down all the references to `Sk.builtin.nmber` and replace them with the appropriate class.\r\n\r\n```javascript\r\nnew Sk.builtin.nmber(a, Sk.builtin.nmber.int$)      -->     new Sk.builtin.int_(a)\r\nnew Sk.builtin.nmber(a, Sk.builtin.nmber.float$)    -->     new Sk.builtin.float_(a)\r\nnew Sk.builtin.nmber(a, undefined)                  -->     Sk.builtin.assk$(a)\r\n```\r\n\r\nI modified `Sk.builtin.assk$` to return a new instance of the appropriate class based on a given Javascript value. This can be helpful If the type of number is not known at compile time, as previously passing `undefined` as the type to `Sk.builtin.nmber` accomplished the same thing.\r\n\r\nCurrently, `Sk.builtin.nmber` still exists largely unmodified, except that the constructor returns an instance of either `Sk.builtin.float_` or `Sk.builtin.int_`. If a third party module calls the constructor, they shouldn't have any problems. However, if they attempt to use any of the methods directly (i.e. `Sk.builtin.nmber.prototype.nb$add(x)`) they may experience problems. \r\n\r\nIf this PR is accepted, we'll need to address those inconsistencies. To my mind, there are two real options:\r\n- Make `Sk.builtin.nmber` methods call the corresponding methods in `Sk.builtin.int_` or `Sk.builtin.float_`\r\n- Throw a deprecated error from all `Sk.builtin.nmber` methods indicating that maintainers should switch to the new number types\r\n\r\nPersonally, the former seems a bit close to silent failure and could also introduce new bugs. However, it might be a gentler transition. What do y'all think? Am I missing another option?"},"comment":{"url":"https://api.github.com/repos/skulpt/skulpt/issues/comments/112849320","html_url":"https://github.com/skulpt/skulpt/pull/484#issuecomment-112849320","issue_url":"https://api.github.com/repos/skulpt/skulpt/issues/484","id":112849320,"user":{"login":"albertjan","id":301791,"avatar_url":"https://avatars.githubusercontent.com/u/301791?v=3","gravatar_id":"","url":"https://api.github.com/users/albertjan","html_url":"https://github.com/albertjan","followers_url":"https://api.github.com/users/albertjan/followers","following_url":"https://api.github.com/users/albertjan/following{/other_user}","gists_url":"https://api.github.com/users/albertjan/gists{/gist_id}","starred_url":"https://api.github.com/users/albertjan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/albertjan/subscriptions","organizations_url":"https://api.github.com/users/albertjan/orgs","repos_url":"https://api.github.com/users/albertjan/repos","events_url":"https://api.github.com/users/albertjan/events{/privacy}","received_events_url":"https://api.github.com/users/albertjan/received_events","type":"User","site_admin":false},"created_at":"2015-06-17T15:33:30Z","updated_at":"2015-06-17T15:33:30Z","body":"Don't worry about it, git usually gets things right but it isn't fail safe. Thanks for looking into it!"}}