-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Comprehensions can't handle arguments objects. #33
Comments
could CS replace the arguments keyword with an Array.spliced version ? I thought about suggesting this before. x: => for arg in arguments ... var x x = function x() { var _arguments = Array.prototype.slice.call(arguments,0,arguments.length) for(var i in _arguments) .... (function(){ var args = Array.prototype.slice.call(arguments,0,arguments.length); for (key in args) console.log(key) })(1, 2, 3) // => 1 2 3 |
We could add it as a check on obj.length -- you don't want to do it for vanilla objects (it makes them disappear), just arguments objects. So then you'd have to do the "isArguments" check for every array comprehension, which is a bit nasty. It's better to have CoffeeScript generate as little code as possible. |
but isn't the problem only ever on the keyword "arguments". Can't we look for that keyword and substitute? |
I wish.
Boom. |
Oh, I'm sorry, what you're suggesting is totally great. I'm just sleep deprived. I'll make a patch for it. Edit: |
…s#33) This fixes stack traces in other tools. This also changes the header to just use 2.2.1 instead of the package.json version.
A little help would be good on this one. Our array/object comprehensions can't handle argument objects being passed. The for..in loop doesn't see any properties on them, and doesn't run. Is there any way around this, other than generating two code paths for comprehensions (one for arrays/arguments and one for objects)? See the following JS:
The text was updated successfully, but these errors were encountered: