{"action":"created","issue":{"url":"https://api.github.com/repos/logancollins/Mocha/issues/28","labels_url":"https://api.github.com/repos/logancollins/Mocha/issues/28/labels{/name}","comments_url":"https://api.github.com/repos/logancollins/Mocha/issues/28/comments","events_url":"https://api.github.com/repos/logancollins/Mocha/issues/28/events","html_url":"https://github.com/logancollins/Mocha/issues/28","id":67939485,"number":28,"title":"[MOObjectDescription addInstanceMethodWithSelector:function:] causes crashes when argument list isn't exact","user":{"login":"matt-curtis","id":1414704,"avatar_url":"https://avatars.githubusercontent.com/u/1414704?v=3","gravatar_id":"","url":"https://api.github.com/users/matt-curtis","html_url":"https://github.com/matt-curtis","followers_url":"https://api.github.com/users/matt-curtis/followers","following_url":"https://api.github.com/users/matt-curtis/following{/other_user}","gists_url":"https://api.github.com/users/matt-curtis/gists{/gist_id}","starred_url":"https://api.github.com/users/matt-curtis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/matt-curtis/subscriptions","organizations_url":"https://api.github.com/users/matt-curtis/orgs","repos_url":"https://api.github.com/users/matt-curtis/repos","events_url":"https://api.github.com/users/matt-curtis/events{/privacy}","received_events_url":"https://api.github.com/users/matt-curtis/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2015-04-12T17:56:44Z","updated_at":"2015-04-17T20:44:39Z","closed_at":null,"body":"Calling this method behaves oddly in regards to arguments:\r\n\r\n1.) When the JavaScript function is called, the `arguments` variable is only ever as populated as the predefined arguments. E.g, when assigning the function `function(){ arguments }` to a method selector such as `\"my:method:selector:\"` `arguments.length` will always equal `0`, regardless of the actual parameters sent along with the message.\r\n\r\n2.) The function specified can only have the exact same (or less) number of arguments as the selector has parameters. Any greater number of arguments causes the runtime to crash. For the selector `\"my:method:selector:\"` this function will work: `function(a, b, c){}` but  `function(a, b, c, d){ arguments }` causes a crash. This breaks and defies the fluid nature of JavaScript `Function` arguments.\r\n\r\nIt also appears that calling this method (and it's companion addClassMethod version) can cause the `JSValue` and its `JSContext` to be retained."},"comment":{"url":"https://api.github.com/repos/logancollins/Mocha/issues/comments/94071299","html_url":"https://github.com/logancollins/Mocha/issues/28#issuecomment-94071299","issue_url":"https://api.github.com/repos/logancollins/Mocha/issues/28","id":94071299,"user":{"login":"afedor","id":6344186,"avatar_url":"https://avatars.githubusercontent.com/u/6344186?v=3","gravatar_id":"","url":"https://api.github.com/users/afedor","html_url":"https://github.com/afedor","followers_url":"https://api.github.com/users/afedor/followers","following_url":"https://api.github.com/users/afedor/following{/other_user}","gists_url":"https://api.github.com/users/afedor/gists{/gist_id}","starred_url":"https://api.github.com/users/afedor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/afedor/subscriptions","organizations_url":"https://api.github.com/users/afedor/orgs","repos_url":"https://api.github.com/users/afedor/repos","events_url":"https://api.github.com/users/afedor/events{/privacy}","received_events_url":"https://api.github.com/users/afedor/received_events","type":"User","site_admin":false},"created_at":"2015-04-17T20:44:39Z","updated_at":"2015-04-17T20:44:39Z","body":"Well your still left with having to store the mapping between the function and the selector somewhere - although in this case you could probably put it in the shim class itself"}}