{"action":"created","issue":{"url":"https://api.github.com/repos/KSP-KOS/KOS/issues/1107","labels_url":"https://api.github.com/repos/KSP-KOS/KOS/issues/1107/labels{/name}","comments_url":"https://api.github.com/repos/KSP-KOS/KOS/issues/1107/comments","events_url":"https://api.github.com/repos/KSP-KOS/KOS/issues/1107/events","html_url":"https://github.com/KSP-KOS/KOS/issues/1107","id":96690904,"number":1107,"title":"Place parameter check up top.  Prevents varargs, but is more robust.","user":{"login":"Dunbaratu","id":5216848,"avatar_url":"https://avatars.githubusercontent.com/u/5216848?v=3","gravatar_id":"","url":"https://api.github.com/users/Dunbaratu","html_url":"https://github.com/Dunbaratu","followers_url":"https://api.github.com/users/Dunbaratu/followers","following_url":"https://api.github.com/users/Dunbaratu/following{/other_user}","gists_url":"https://api.github.com/users/Dunbaratu/gists{/gist_id}","starred_url":"https://api.github.com/users/Dunbaratu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Dunbaratu/subscriptions","organizations_url":"https://api.github.com/users/Dunbaratu/orgs","repos_url":"https://api.github.com/users/Dunbaratu/repos","events_url":"https://api.github.com/users/Dunbaratu/events{/privacy}","received_events_url":"https://api.github.com/users/Dunbaratu/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"Dunbaratu","id":5216848,"avatar_url":"https://avatars.githubusercontent.com/u/5216848?v=3","gravatar_id":"","url":"https://api.github.com/users/Dunbaratu","html_url":"https://github.com/Dunbaratu","followers_url":"https://api.github.com/users/Dunbaratu/followers","following_url":"https://api.github.com/users/Dunbaratu/following{/other_user}","gists_url":"https://api.github.com/users/Dunbaratu/gists{/gist_id}","starred_url":"https://api.github.com/users/Dunbaratu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Dunbaratu/subscriptions","organizations_url":"https://api.github.com/users/Dunbaratu/orgs","repos_url":"https://api.github.com/users/Dunbaratu/repos","events_url":"https://api.github.com/users/Dunbaratu/events{/privacy}","received_events_url":"https://api.github.com/users/Dunbaratu/received_events","type":"User","site_admin":false},"milestone":null,"comments":6,"created_at":"2015-07-22T23:33:55Z","updated_at":"2015-07-23T12:57:57Z","closed_at":null,"body":"@gisikw posted an issue, #1100 which is closed, but I'd still like to address an issue connected to it.\r\n\r\nThe problem is that since we don't check number of arguments until the bottom of the function, users typically end up seeing complaints about wrong argument types before they see a complaint about mismatched arguments, because passing the wrong number of args causes stack misalignment.  (Which IS detected eventually, but not until after it tried using the values that were shifted into the wrong variables, which often causes its own errors that stop it before it gets to the check for missing or too many args).\r\n\r\nThe entire reason for not checking until the bottom was to allow for clever varying args situations where you execute the ``declare parameter`` commands conditionally depending on what you see.\r\n\r\nBut I doubt anyone is doing this, and it's preventing us from giving proper error messages out for mismatched argument counts.\r\n\r\nI'd like to switch it to a system that requires the declare parameter commands to be \"flat\" in the outermost nesting level (not contained inside loops or if's), and can throw an error right away when they don't have the right number of arguments to match.  I might provide people with an alternate technique where they can get a LIST() of parameters instead if they like to try some vararg logic.\r\n"},"comment":{"url":"https://api.github.com/repos/KSP-KOS/KOS/issues/comments/124087157","html_url":"https://github.com/KSP-KOS/KOS/issues/1107#issuecomment-124087157","issue_url":"https://api.github.com/repos/KSP-KOS/KOS/issues/1107","id":124087157,"user":{"login":"hvacengi","id":2975036,"avatar_url":"https://avatars.githubusercontent.com/u/2975036?v=3","gravatar_id":"","url":"https://api.github.com/users/hvacengi","html_url":"https://github.com/hvacengi","followers_url":"https://api.github.com/users/hvacengi/followers","following_url":"https://api.github.com/users/hvacengi/following{/other_user}","gists_url":"https://api.github.com/users/hvacengi/gists{/gist_id}","starred_url":"https://api.github.com/users/hvacengi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hvacengi/subscriptions","organizations_url":"https://api.github.com/users/hvacengi/orgs","repos_url":"https://api.github.com/users/hvacengi/repos","events_url":"https://api.github.com/users/hvacengi/events{/privacy}","received_events_url":"https://api.github.com/users/hvacengi/received_events","type":"User","site_admin":false},"created_at":"2015-07-23T12:57:57Z","updated_at":"2015-07-23T12:57:57Z","body":"Good point.  Just pass the lex as a parameter itself... Why did I want to make that more complicated?"}}