RE: Terminology: “non-method function”
domenic at domenicdenicola.com
Wed Apr 11 09:56:23 PDT 2012
We use `Function.prototype.partial` in our codebase. We consider `Function.prototype.papply` but thought that would be too confusing with `Function.prototype.apply`.
From: es-discuss-bounces at mozilla.org [es-discuss-bounces at mozilla.org] on behalf of Axel Rauschmayer [axel at rauschma.de]
Sent: Wednesday, April 11, 2012 12:54
To: Allen Wirfs-Brock
Subject: Re: Terminology: “non-method function”
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<mailto: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
If you want to create a curried function from fn with 1 and 2 as the first two fn arguments. and:
if you want to created a bound version of fn where this is bound to the value of foo.
The semantics of
could then be explained as being equivalent to
Dr. Axel Rauschmayer
axel at rauschma.de<mailto:axel at rauschma.de>
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss