Re: Terminology: “non-method function”

Axel Rauschmayer axel at rauschma.de
Wed Apr 11 09:54:22 PDT 2012


Great idea. Do we need similar this-less variants for call and apply? Probably not, the former is just a normal function call. The latter can by handled by the spread operator.

IIRC, what one actually does here is not currying, but partial application. However, I don’t see any good method name being derived from “partial application”.


On Apr 11, 2012, at 18:44 , Allen Wirfs-Brock wrote:

> 
> On Apr 11, 2012, at 7:12 AM, Peter van der Zee wrote:
> 
>> On Wed, Apr 11, 2012 at 1:01 AM, Axel Rauschmayer <axel at rauschma.de> wrote:
>>> What is a good term for functions that don’t have/use dynamic `this`?
>> 
>> A bound function?
> 
> I'm leaning in that direction.  A bound function has an unbound (dynamic) this while a bound function has a bound (fixed) this.
> 
> To further clarify this it might be useful to better differentiate  binding this from currying the arguments.
> 
> We might do this by adding a new Function.prototype.curry function that doesn't have a this value as its first argument.
> 
> You would then
>  fn.curry(1,2)
> 
> If you want to create a curried function from fn with 1 and 2 as the first two fn arguments. and:
> 
>  fn.bind(foo)
> 
> if you want to created a bound version of fn where this is bound to the value of foo.
> 
> The semantics of 
> 
>    fn.bind(foo,1,2)
> 
> could then be explained as being equivalent to 
> 
>    fn.bind(foo).curry(1,2)
> 
> Allen
> 
> 
> 
> 
> 

-- 
Dr. Axel Rauschmayer
axel at rauschma.de

home: rauschma.de
twitter: twitter.com/rauschma
blog: 2ality.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20120411/73c9bc2a/attachment-0001.html>


More information about the es-discuss mailing list