{"action":"created","issue":{"url":"https://api.github.com/repos/opal/opal/issues/1117","labels_url":"https://api.github.com/repos/opal/opal/issues/1117/labels{/name}","comments_url":"https://api.github.com/repos/opal/opal/issues/1117/comments","events_url":"https://api.github.com/repos/opal/opal/issues/1117/events","html_url":"https://github.com/opal/opal/pull/1117","id":108565901,"number":1117,"title":"Raise/Fail Exception Rubyspec Compliance","user":{"login":"wied03","id":297123,"avatar_url":"https://avatars.githubusercontent.com/u/297123?v=3","gravatar_id":"","url":"https://api.github.com/users/wied03","html_url":"https://github.com/wied03","followers_url":"https://api.github.com/users/wied03/followers","following_url":"https://api.github.com/users/wied03/following{/other_user}","gists_url":"https://api.github.com/users/wied03/gists{/gist_id}","starred_url":"https://api.github.com/users/wied03/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wied03/subscriptions","organizations_url":"https://api.github.com/users/wied03/orgs","repos_url":"https://api.github.com/users/wied03/repos","events_url":"https://api.github.com/users/wied03/events{/privacy}","received_events_url":"https://api.github.com/users/wied03/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-09-27T22:55:54Z","updated_at":"2015-09-27T23:13:03Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/opal/opal/pulls/1117","html_url":"https://github.com/opal/opal/pull/1117","diff_url":"https://github.com/opal/opal/pull/1117.diff","patch_url":"https://github.com/opal/opal/pull/1117.patch"},"body":"(moved work in https://github.com/opal/opal/pull/1105 to another branch):\r\n\r\nThis passes all of the raise/fail rubyspecs (except private methods). It comes at a cost though. In order to reset $! after every rescue like MRI does, I had to alter the compiler to make it a stack (JS array).\r\n\r\nI realize that may be too much since it adds a try {} finally {} to **every** rescue block. I thought I'd put it out here and see though.\r\n\r\nIf this can't be done cleanly using my approach or another approach, then I think Opal should explicitly say:\r\n* $! is not a supported global variable\r\n* As a result, you cannot re-raise exceptions by calling 'raise' without parameters\r\n\r\nIf this **is** acceptable, then:\r\n* I could also use some feedback on how I did the compiler tweaks. I didn't spend much time trying to do it 100% right since the idea might get squashed anyways.\r\n* I'll squash the commits"},"comment":{"url":"https://api.github.com/repos/opal/opal/issues/comments/143602187","html_url":"https://github.com/opal/opal/pull/1117#issuecomment-143602187","issue_url":"https://api.github.com/repos/opal/opal/issues/1117","id":143602187,"user":{"login":"elia","id":1051,"avatar_url":"https://avatars.githubusercontent.com/u/1051?v=3","gravatar_id":"","url":"https://api.github.com/users/elia","html_url":"https://github.com/elia","followers_url":"https://api.github.com/users/elia/followers","following_url":"https://api.github.com/users/elia/following{/other_user}","gists_url":"https://api.github.com/users/elia/gists{/gist_id}","starred_url":"https://api.github.com/users/elia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elia/subscriptions","organizations_url":"https://api.github.com/users/elia/orgs","repos_url":"https://api.github.com/users/elia/repos","events_url":"https://api.github.com/users/elia/events{/privacy}","received_events_url":"https://api.github.com/users/elia/received_events","type":"User","site_admin":false},"created_at":"2015-09-27T23:13:03Z","updated_at":"2015-09-27T23:13:03Z","body":"Another thing to consider is that `try/catch` blocks seem to be not-optimizable as pointed by @jgaskins [in the gitter channel](https://gitter.im/opal/opal?at=560740ebefd97f3e4669a564)\r\n\r\n> try blocks can't be optimized, so I'm trying to figure out why it happens and see if there's a way we can work around it. For example, if the entire try block were contained within another function, that function could be optimized and we wouldn't need to worry about it, since the amount of time spent in the try block (in that stack frame, anyway) would be negligible."}}