I did indeed !!! Interesting, thanks for the clarification.
On Tue, May 27, 2014 at 3:44 PM, Claude Pache wrote:
>
> Le 27 mai 2014 à 20:59, Andrea Giammarchi a
> écrit :
>
> > Sorry Nathan but how is this different from extending Object prototype?
> you are basically polluting everywhere `::`
Le 27 mai 2014 à 20:59, Andrea Giammarchi a écrit
:
> Sorry Nathan but how is this different from extending Object prototype? you
> are basically polluting everywhere `::` operator, can't see any less
> conflictual scenario than just "polluting the `.` one" in terms of prototype
There is no
This sounds good to me. Just a nit, you should define:
Function.curryThis = function(f, base = undefined) {
return function(...args) {
return f.call(base, this, ...args);
};
};
so that you can do, e.g.,
class ImprovedArray extends Array { /* _not_ overloa
On Tue, May 27, 2014 at 12:40 PM, Jasper St. Pierre
wrote:
> From my reading of the email and strawman page, let f = obj::foo; is exactly
> equivalent to let f = foo.bind(obj);
>
> Am I wrong? How is the result subtly different?
Brendan's saying that the return value of foo.bind(obj) is subtly
di
>From my reading of the email and strawman page, let f = obj::foo; is
exactly equivalent to let f = foo.bind(obj);
Am I wrong? How is the result subtly different?
Really, with "obj::foo", I would expect "obj::foo" to be the same as
"obj.foo.bind(obj);", not "foo.bind(obj);" And even then, I don't
Jasper St. Pierre wrote:
I'm not sure I like it. Given how other languages use the "::"
operator, I'd expect "Foo::bar" to do some sort of static property
lookup for a name called "bar" on "Foo", not bind the local variable
"Foo" to the local variable "bar".
That's not what the proposed bind
PropertyDescriptor('elements');
>
> It's the same proposal as yours with slightly different syntax. And I
> think the syntax makes some sense given a bind operator `::`.
>
> [1] http://wiki.ecmascript.org/doku.php?id=strawman:bind_operator
>
>
>
>
>
I'm not sure I like it. Given how other languages use the "::" operator,
I'd expect "Foo::bar" to do some sort of static property lookup for a name
called "bar" on "Foo", not bind the local variable "Foo" to the local
variable "bar". I think "bar.bind(Foo)" is more than enough. I am OK with
your "c
(Sorry about the formatting in the last one. Trying again.)
I have a syntax proposal, but it goes along with a slightly different way of
thinking of this.
The proposed bind operator[1] can take a function which acts as a method and
make a call to it with a specific receiver without the receiver
or
Date: Tue, 27 May 2014 11:04:52 -0400
Subject: Re: Syntactic sugar for using a function as if it were a method of
its first argument
From: jstpie...@mecheye.net
To: claude.pa...@gmail.com
CC: es-discuss@mozilla.org
It's fairly incomprehensible to me, and doesn
( already covered to receive stones )
```javascript
Object.defineProperty(
Object.prototype,
'through',
{
enumerable: false,
configurable: true,
writable: true,
value: function through(callback) {
for (var a = [this], i = 1; i < arguments.length; a[i] =
arguments[i++])
I like the idea, but I agree that the .{ } syntax isn't quite right. For
one thing, on my screen the () are visually very similar to {}, while []
are easily distinguished. The leading dot is also a bit odd. I'd be
interested in seeing some more alternative syntaxes for this idea.
--scott
On
Le 27 mai 2014 à 17:04, Jasper St. Pierre a écrit :
>
> (...) Namely, the whole ('elements') looks like a method call containing one
> argument, rather than having a secret hidden argument as its first.
>
Yes, it was exactly intended to appear as such, making
`obj.{Object.getOwnPropertyDesc
It's fairly incomprehensible to me, and doesn't really have any advantages
over writing it out the long way:
Object.getOwnPropertyDescriptor(window.HTMLFormElement.prototype,
'elements').get
window.HTMLFormElement.prototype{Object.getOwnPropertyDescriptor}('elements').get
They're both the s
Often a function can be thought as if it were a method of its first argument.
Compare:
Array.from(obj); /* vs */ obj.toString()
Object.getPrototypeOf(obj); /* vs */ obj.__proto__
Array.forEach(obj, func); /* vs */ obj.forEach(func)
Math.clz32(num); /
15 matches
Mail list logo