

Implementing a CoffeeScript Feature in Pure JavaScript - raganwald
https://github.com/raganwald/homoiconic/blob/master/2012/12/end_of_days_ellipses.md#the-end-of-days-implementing-a-coffeescript-feature-in-pure-javascript

======
bmuon
This is coming in the next version of EcmaScript. See Rest Parameters:
[http://wiki.ecmascript.org/doku.php?id=harmony:rest_paramete...](http://wiki.ecmascript.org/doku.php?id=harmony:rest_parameters)

If you're adventurous or just OK with the idea of using
transpilers/precompilers (which you would be if you like CoffeeScript), you
can use rest parameters with Traceur [1] or TypeScript [2].

[1] <http://code.google.com/p/traceur-compiler/> [2]
<http://www.typescriptlang.org/>

------
Benvie
Most useful features in CoffeeScript have been co-opted by ES6 and its
proliferation will put pressure on CS to innovate some new features or become
much less relevant. The "ideal" JS code near the end of the article almost is
valid ES6. The following _is_ valid ES6:

    
    
        var leftPartial = (fn, ...args) => function(...remainingArgs){
          return fn.apply(this, args.concat(remainingArgs));
        };
        

Run it in <http://benvie.github.com/continuum>.

------
CJefferson
This is really nice, both for showing a useful feature, and also for helping
expand my mind on how useful functions which take functions and return another
function can be!

------
camus
> Works like a charm!

but is ugly. When a feature is part of a language , you dont need to look at
the source code of the language to understand how to use it, nor have to
import yet another script to make it work.

~~~
raganwald
_When a feature is part of a language , you dont need to look at the source
code of the language to understand how to use it_

WHy do you have to look at source code? If I tell you that the Underscore
library includes a function called "once" that does such-and-such, you can
just use "once," correct?

Same with "ellipses." You don't have to look at the source code if you don't
want to.

 _import yet another script to make it work_

Ah, this is a deep philosophical question, well worth consideration.

One philosophy is to have a language that does everything and has extensive
official libraries. Java went down this road under Sun's stewardship. The
other philosophy is to make the language smaller but powerful enough that
people could invent their own stuff and let "the marketplace" decide.

JavaScript is mostly going down this road. Things like "let" and "=>" are
being added to the language, but at a fairly slow pace because the language
does support creating your own idioms to accomplish the same things, so making
it part of the syntax waits until there is an overwhelming mass of programmers
who are familiar with the idea.

