Giter Club home page Giter Club logo

Comments (5)

weepy avatar weepy commented on July 23, 2024

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

from coffeescript.

jashkenas avatar jashkenas commented on July 23, 2024

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.

from coffeescript.

weepy avatar weepy commented on July 23, 2024

but isn't the problem only ever on the keyword "arguments". Can't we look for that keyword and substitute?

from coffeescript.

jashkenas avatar jashkenas commented on July 23, 2024

I wish.

 func: =>
   something: arguments
   arg for arg in something

Boom.

from coffeescript.

jashkenas avatar jashkenas commented on July 23, 2024

Oh, I'm sorry, what you're suggesting is totally great. I'm just sleep deprived. I'll make a patch for it.

Edit:
It's now on master. Thanks weepy. Closing the ticket.

from coffeescript.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.