-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
arguments var missing in ki functions #25
Comments
This one is tricky. ki uses a lot of intermediate immediate function invocations to achieve proper lexical scoping and at the same time the JavaScript What we could do is store the content of the I'm wondering whether this is the right thing to do as opposed to trying to cover the edge cases directly. Any thoughts? Also, can you provide an example of edge case with code? Thanks! |
Actually, it's easier than I thought. Let's start from the current state of things: arguments is correct and available right after entering the function body, e.g.
prints
prints However, we can get to it with the help of a macro
prints Feel free to let me know your thoughts. |
Much better than nothing! This is a working solution. And considering that the |
Thanks for the feedback. Another couple of (not necessarily better) options
|
Sometimes it's useful to have the
arguments
var available, just like js functions offer. Some cases can't quite be covered with variadic arity / multimethod functions. For example variable args with last arg a callback, or whatever other edge-case scenario. In any case, people could write their functions in ki without missing javascript'sarguments
or falling back to javascript for that reason. Otherwise useful just for the sake of matching-up the host language.The text was updated successfully, but these errors were encountered: