Proposal: Additional Meta Properties for ES7

classic Classic list List threaded Threaded
33 messages Options
12
Reply | Threaded
Open this post in threaded view
|

Proposal: Additional Meta Properties for ES7

Allen Wirfs-Brock
Here is a new proposal for some additional meta properties that should be considered for ES7
https://github.com/allenwb/ESideas/blob/master/ES7MetaProps.md 

I've added this to the agenda for next months TC39 meeting but pre-meeting discussion is always welcomed right here.

Allen


_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss
Reply | Threaded
Open this post in threaded view
|

Re: Proposal: Additional Meta Properties for ES7

Claude Pache
Alternative name for `function.callee`:  I find that `function.self` sounds better in case of recursive call (and probably in other cases as well).

—Claude

Le 26 févr. 2015 à 23:47, Allen Wirfs-Brock <[hidden email]> a écrit :

Here is a new proposal for some additional meta properties that should be considered for ES7
https://github.com/allenwb/ESideas/blob/master/ES7MetaProps.md 

I've added this to the agenda for next months TC39 meeting but pre-meeting discussion is always welcomed right here.

Allen

_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss


_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss
Reply | Threaded
Open this post in threaded view
|

Re: Proposal: Additional Meta Properties for ES7

Tab Atkins Jr.
On Thu, Feb 26, 2015 at 3:27 PM, Claude Pache <[hidden email]> wrote:
> Alternative name for `function.callee`:  I find that `function.self` sounds
> better in case of recursive call (and probably in other cases as well).

Agreed that "callee", while technically accurate, is a clumsy word and
something like "self" sounds better.  "function.self", in particular,
seems to communicate the right semantic, and implies that you're
receiving a function .

It doesn't feel... apt, I think, to bring the caller/callee
relationship to mind when you're not trying to deal with that
relationship; all you're trying to do is recurse on yourself, in the
case where you don't have a name to refer to yourself with.  The fact
that you're running because someone else called you is irrelevant to
this dynamic.

~TJ
_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss
Reply | Threaded
Open this post in threaded view
|

Re: Proposal: Additional Meta Properties for ES7

Andrea Giammarchi-2
In reply to this post by Claude Pache
I personally wouldn't mind `self` but it has been historically used as context or global reference, while callee ... you don't probably need to explain what's that about.

On the other hand, from `arguments` object, `callee`was more semantic but it feels not th ebest choice from `function` indeed.

Decisions ... decisions ...

On Thu, Feb 26, 2015 at 11:27 PM, Claude Pache <[hidden email]> wrote:
Alternative name for `function.callee`:  I find that `function.self` sounds better in case of recursive call (and probably in other cases as well).

—Claude

Le 26 févr. 2015 à 23:47, Allen Wirfs-Brock <[hidden email]> a écrit :

Here is a new proposal for some additional meta properties that should be considered for ES7
https://github.com/allenwb/ESideas/blob/master/ES7MetaProps.md 

I've added this to the agenda for next months TC39 meeting but pre-meeting discussion is always welcomed right here.

Allen

_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss


_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss



_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss
Reply | Threaded
Open this post in threaded view
|

Re: Proposal: Additional Meta Properties for ES7

Andrea Giammarchi-2
In reply to this post by Tab Atkins Jr.
agreed ... between `self` and `callee` probably `self` is better. Anyone with a different/new idea?

On Thu, Feb 26, 2015 at 11:50 PM, Tab Atkins Jr. <[hidden email]> wrote:
On Thu, Feb 26, 2015 at 3:27 PM, Claude Pache <[hidden email]> wrote:
> Alternative name for `function.callee`:  I find that `function.self` sounds
> better in case of recursive call (and probably in other cases as well).

Agreed that "callee", while technically accurate, is a clumsy word and
something like "self" sounds better.  "function.self", in particular,
seems to communicate the right semantic, and implies that you're
receiving a function .

It doesn't feel... apt, I think, to bring the caller/callee
relationship to mind when you're not trying to deal with that
relationship; all you're trying to do is recurse on yourself, in the
case where you don't have a name to refer to yourself with.  The fact
that you're running because someone else called you is irrelevant to
this dynamic.

~TJ
_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss


_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss
Reply | Threaded
Open this post in threaded view
|

RE: Proposal: Additional Meta Properties for ES7

Domenic Denicola
function.current?

From: [hidden email]
Sent: ‎2015-‎02-‎26 18:56
To: [hidden email]
Cc: [hidden email]
Subject: Re: Proposal: Additional Meta Properties for ES7

agreed ... between `self` and `callee` probably `self` is better. Anyone with a different/new idea?

On Thu, Feb 26, 2015 at 11:50 PM, Tab Atkins Jr. <[hidden email]> wrote:
On Thu, Feb 26, 2015 at 3:27 PM, Claude Pache <[hidden email]> wrote:
> Alternative name for `function.callee`:  I find that `function.self` sounds
> better in case of recursive call (and probably in other cases as well).

Agreed that "callee", while technically accurate, is a clumsy word and
something like "self" sounds better.  "function.self", in particular,
seems to communicate the right semantic, and implies that you're
receiving a function .

It doesn't feel... apt, I think, to bring the caller/callee
relationship to mind when you're not trying to deal with that
relationship; all you're trying to do is recurse on yourself, in the
case where you don't have a name to refer to yourself with.  The fact
that you're running because someone else called you is irrelevant to
this dynamic.

~TJ
_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss


_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss
Reply | Threaded
Open this post in threaded view
|

Re: Proposal: Additional Meta Properties for ES7

Andrea Giammarchi-2
had same thought ... that wouldn't need much explanation neither. +1 here

On Thu, Feb 26, 2015 at 11:59 PM, Domenic Denicola <[hidden email]> wrote:
function.current?

From: [hidden email]
Sent: ‎2015-‎02-‎26 18:56
To: [hidden email]
Cc: [hidden email]
Subject: Re: Proposal: Additional Meta Properties for ES7

agreed ... between `self` and `callee` probably `self` is better. Anyone with a different/new idea?

On Thu, Feb 26, 2015 at 11:50 PM, Tab Atkins Jr. <[hidden email]> wrote:
On Thu, Feb 26, 2015 at 3:27 PM, Claude Pache <[hidden email]> wrote:
> Alternative name for `function.callee`:  I find that `function.self` sounds
> better in case of recursive call (and probably in other cases as well).

Agreed that "callee", while technically accurate, is a clumsy word and
something like "self" sounds better.  "function.self", in particular,
seems to communicate the right semantic, and implies that you're
receiving a function .

It doesn't feel... apt, I think, to bring the caller/callee
relationship to mind when you're not trying to deal with that
relationship; all you're trying to do is recurse on yourself, in the
case where you don't have a name to refer to yourself with.  The fact
that you're running because someone else called you is irrelevant to
this dynamic.

~TJ
_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss



_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss
Reply | Threaded
Open this post in threaded view
|

Re: Proposal: Additional Meta Properties for ES7

Matthew Robb

I think current implies something too dynamic and doesn't seem to carry the impression of identity

On Feb 26, 2015 7:03 PM, "Andrea Giammarchi" <[hidden email]> wrote:
had same thought ... that wouldn't need much explanation neither. +1 here

On Thu, Feb 26, 2015 at 11:59 PM, Domenic Denicola <[hidden email]> wrote:
function.current?

From: [hidden email]
Sent: ‎2015-‎02-‎26 18:56
To: [hidden email]
Cc: [hidden email]
Subject: Re: Proposal: Additional Meta Properties for ES7

agreed ... between `self` and `callee` probably `self` is better. Anyone with a different/new idea?

On Thu, Feb 26, 2015 at 11:50 PM, Tab Atkins Jr. <[hidden email]> wrote:
On Thu, Feb 26, 2015 at 3:27 PM, Claude Pache <[hidden email]> wrote:
> Alternative name for `function.callee`:  I find that `function.self` sounds
> better in case of recursive call (and probably in other cases as well).

Agreed that "callee", while technically accurate, is a clumsy word and
something like "self" sounds better.  "function.self", in particular,
seems to communicate the right semantic, and implies that you're
receiving a function .

It doesn't feel... apt, I think, to bring the caller/callee
relationship to mind when you're not trying to deal with that
relationship; all you're trying to do is recurse on yourself, in the
case where you don't have a name to refer to yourself with.  The fact
that you're running because someone else called you is irrelevant to
this dynamic.

~TJ
_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss



_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss


_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss
Reply | Threaded
Open this post in threaded view
|

Re: Proposal: Additional Meta Properties for ES7

Garrett Smith
In reply to this post by Allen Wirfs-Brock
Can you show an example of how callee is used with a fat arrow function?

(()=>{alert(callee);})()

Thanks.

On 2/26/15, Allen Wirfs-Brock <[hidden email]> wrote:

> Here is a new proposal for some additional meta properties that should be
> considered for ES7
> https://github.com/allenwb/ESideas/blob/master/ES7MetaProps.md
>
> I've added this to the agenda for next months TC39 meeting but pre-meeting
> discussion is always welcomed right here.
>
> Allen
>
>


--
Garrett
@xkit
ChordCycles.com
garretts.github.io
_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss
Reply | Threaded
Open this post in threaded view
|

Re: Proposal: Additional Meta Properties for ES7

Allen Wirfs-Brock
In reply to this post by Domenic Denicola
Once you are willing to move beyond "callee", there are a whole lot of available English words:

function.me
function.here
function.this   (I kinda like it but I also don't believe it would be a good choice)
function.target
function.self  (suggested by Claude)
function.object  (you are accessing the active function function)
function.active
function.recur
function.home
function.enclosing

and no doubt many more...

allen



On Feb 26, 2015, at 3:59 PM, Domenic Denicola wrote:

function.current?

From: [hidden email]
Sent: ‎2015-‎02-‎26 18:56
To: [hidden email]
Cc: [hidden email]
Subject: Re: Proposal: Additional Meta Properties for ES7

agreed ... between `self` and `callee` probably `self` is better. Anyone with a different/new idea?

On Thu, Feb 26, 2015 at 11:50 PM, Tab Atkins Jr. <[hidden email]> wrote:
On Thu, Feb 26, 2015 at 3:27 PM, Claude Pache <[hidden email]> wrote:
> Alternative name for `function.callee`:  I find that `function.self` sounds
> better in case of recursive call (and probably in other cases as well).

Agreed that "callee", while technically accurate, is a clumsy word and
something like "self" sounds better.  "function.self", in particular,
seems to communicate the right semantic, and implies that you're
receiving a function .

It doesn't feel... apt, I think, to bring the caller/callee
relationship to mind when you're not trying to deal with that
relationship; all you're trying to do is recurse on yourself, in the
case where you don't have a name to refer to yourself with.  The fact
that you're running because someone else called you is irrelevant to
this dynamic.

~TJ
_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss

_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss


_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss
Reply | Threaded
Open this post in threaded view
|

Re: Proposal: Additional Meta Properties for ES7

Allen Wirfs-Brock
In reply to this post by Garrett Smith
((n)=>n>1? n*function.callee(n-1) : 1)





On Feb 26, 2015, at 4:42 PM, Garrett Smith wrote:

> Can you show an example of how callee is used with a fat arrow function?
>
> (()=>{alert(callee);})()
>
> Thanks.
>
> On 2/26/15, Allen Wirfs-Brock <[hidden email]> wrote:
>> Here is a new proposal for some additional meta properties that should be
>> considered for ES7
>> https://github.com/allenwb/ESideas/blob/master/ES7MetaProps.md
>>
>> I've added this to the agenda for next months TC39 meeting but pre-meeting
>> discussion is always welcomed right here.
>>
>> Allen
>>
>>
>
>
> --
> Garrett
> @xkit
> ChordCycles.com
> garretts.github.io
>

_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss
Reply | Threaded
Open this post in threaded view
|

Re: Proposal: Additional Meta Properties for ES7

Tom Schuster

I think it's easier to convey the message to never use "callee" instead use function.self.

On Feb 27, 2015 1:52 AM, "Allen Wirfs-Brock" <[hidden email]> wrote:
((n)=>n>1? n*function.callee(n-1) : 1)





On Feb 26, 2015, at 4:42 PM, Garrett Smith wrote:

> Can you show an example of how callee is used with a fat arrow function?
>
> (()=>{alert(callee);})()
>
> Thanks.
>
> On 2/26/15, Allen Wirfs-Brock <[hidden email]> wrote:
>> Here is a new proposal for some additional meta properties that should be
>> considered for ES7
>> https://github.com/allenwb/ESideas/blob/master/ES7MetaProps.md
>>
>> I've added this to the agenda for next months TC39 meeting but pre-meeting
>> discussion is always welcomed right here.
>>
>> Allen
>>
>>
>
>
> --
> Garrett
> @xkit
> ChordCycles.com
> garretts.github.io
>

_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss

_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss
Reply | Threaded
Open this post in threaded view
|

Re: Proposal: Additional Meta Properties for ES7

Matthew Robb
I am positive that there will be good reasons I am just curious what they might be, why not: `function(){ function(); }`


- Matthew Robb

On Thu, Feb 26, 2015 at 8:00 PM, Tom Schuster <[hidden email]> wrote:

I think it's easier to convey the message to never use "callee" instead use function.self.

On Feb 27, 2015 1:52 AM, "Allen Wirfs-Brock" <[hidden email]> wrote:
((n)=>n>1? n*function.callee(n-1) : 1)





On Feb 26, 2015, at 4:42 PM, Garrett Smith wrote:

> Can you show an example of how callee is used with a fat arrow function?
>
> (()=>{alert(callee);})()
>
> Thanks.
>
> On 2/26/15, Allen Wirfs-Brock <[hidden email]> wrote:
>> Here is a new proposal for some additional meta properties that should be
>> considered for ES7
>> https://github.com/allenwb/ESideas/blob/master/ES7MetaProps.md
>>
>> I've added this to the agenda for next months TC39 meeting but pre-meeting
>> discussion is always welcomed right here.
>>
>> Allen
>>
>>
>
>
> --
> Garrett
> @xkit
> ChordCycles.com
> garretts.github.io
>

_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss

_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss



_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss
Reply | Threaded
Open this post in threaded view
|

Re: Proposal: Additional Meta Properties for ES7

Matthew Robb
Or the following three forms would be great:

// normal form
function();
// or
function.invoke();

// additionally
function.call();
function.apply();


- Matthew Robb

On Thu, Feb 26, 2015 at 9:29 PM, Matthew Robb <[hidden email]> wrote:
I am positive that there will be good reasons I am just curious what they might be, why not: `function(){ function(); }`


- Matthew Robb

On Thu, Feb 26, 2015 at 8:00 PM, Tom Schuster <[hidden email]> wrote:

I think it's easier to convey the message to never use "callee" instead use function.self.

On Feb 27, 2015 1:52 AM, "Allen Wirfs-Brock" <[hidden email]> wrote:
((n)=>n>1? n*function.callee(n-1) : 1)





On Feb 26, 2015, at 4:42 PM, Garrett Smith wrote:

> Can you show an example of how callee is used with a fat arrow function?
>
> (()=>{alert(callee);})()
>
> Thanks.
>
> On 2/26/15, Allen Wirfs-Brock <[hidden email]> wrote:
>> Here is a new proposal for some additional meta properties that should be
>> considered for ES7
>> https://github.com/allenwb/ESideas/blob/master/ES7MetaProps.md
>>
>> I've added this to the agenda for next months TC39 meeting but pre-meeting
>> discussion is always welcomed right here.
>>
>> Allen
>>
>>
>
>
> --
> Garrett
> @xkit
> ChordCycles.com
> garretts.github.io
>

_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss

_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss




_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss
Reply | Threaded
Open this post in threaded view
|

Re: Proposal: Additional Meta Properties for ES7

Felipe Nascimento de Moura
Am I the only one who finds it weird to use `function.something` inside a function?

```
function doSomething () {
    function.self...
}
```

That's why I was thinking in something more related to the "scope" than to the function object itself.




On Thu, Feb 26, 2015 at 11:32 PM, Matthew Robb <[hidden email]> wrote:
Or the following three forms would be great:

// normal form
function();
// or
function.invoke();

// additionally
function.call();
function.apply();


- Matthew Robb

On Thu, Feb 26, 2015 at 9:29 PM, Matthew Robb <[hidden email]> wrote:
I am positive that there will be good reasons I am just curious what they might be, why not: `function(){ function(); }`


- Matthew Robb

On Thu, Feb 26, 2015 at 8:00 PM, Tom Schuster <[hidden email]> wrote:

I think it's easier to convey the message to never use "callee" instead use function.self.

On Feb 27, 2015 1:52 AM, "Allen Wirfs-Brock" <[hidden email]> wrote:
((n)=>n>1? n*function.callee(n-1) : 1)





On Feb 26, 2015, at 4:42 PM, Garrett Smith wrote:

> Can you show an example of how callee is used with a fat arrow function?
>
> (()=>{alert(callee);})()
>
> Thanks.
>
> On 2/26/15, Allen Wirfs-Brock <[hidden email]> wrote:
>> Here is a new proposal for some additional meta properties that should be
>> considered for ES7
>> https://github.com/allenwb/ESideas/blob/master/ES7MetaProps.md
>>
>> I've added this to the agenda for next months TC39 meeting but pre-meeting
>> discussion is always welcomed right here.
>>
>> Allen
>>
>>
>
>
> --
> Garrett
> @xkit
> ChordCycles.com
> garretts.github.io
>

_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss

_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss




_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss




--
Felipe N. Moura
Senior Web Developer

Website:  http://felipenmoura.org
Twitter:    @felipenmoura

Meet some of my projects:
BrazilJS Conference  |  BrazilJS Foundation  |  Power Polygon  |  TheWebMind  |  PHPDevBar
---------------------------------
LinuxUser #508332
Changing  the  world  is the least I expect from  myself!

_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss
Reply | Threaded
Open this post in threaded view
|

Re: Proposal: Additional Meta Properties for ES7

Andrea Giammarchi-2
In reply to this post by Garrett Smith
another basic example with listeners

```
window.addEventListener('load', (e) => {
  // how am I going to remove this listener?
  console.log('everything loaded');
});
```

Specially on UI world, many libraries do attach tons of things at runtime, within methods, and have no way to remove them if not believing the DOM will take care of everything.

Timers are also less powerful

```js

setTimeout(function later() {
  if (condition) {
    moveOn();
  } else {
    setTimeout(later, 100);
  }
}, 100);

```

Recursions as Allen wrote already are another example too.

Regards





On Fri, Feb 27, 2015 at 12:42 AM, Garrett Smith <[hidden email]> wrote:
Can you show an example of how callee is used with a fat arrow function?

(()=>{alert(callee);})()

Thanks.

On 2/26/15, Allen Wirfs-Brock <[hidden email]> wrote:
> Here is a new proposal for some additional meta properties that should be
> considered for ES7
> https://github.com/allenwb/ESideas/blob/master/ES7MetaProps.md
>
> I've added this to the agenda for next months TC39 meeting but pre-meeting
> discussion is always welcomed right here.
>
> Allen
>
>


--
Garrett
@xkit
ChordCycles.com
garretts.github.io
_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss


_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss
Reply | Threaded
Open this post in threaded view
|

Re: Proposal: Additional Meta Properties for ES7

Leon Arnott
In reply to this post by Allen Wirfs-Brock
I feel a little unhappy that one meta-property, `new.target`, is lexically scoped in arrow functions but these new ones aren't, without much obviously distinguishing them. I guess you could concoct the reasoning that since arrows can't be `new`'d, `new.[meta-property]` is "meaningless" in it - but that feels like the sort of explanation that makes more sense retrospectively.

On a different tack: I also feel like `new.target` has a significant readability advantage which `function.[meta-property]` sadly doesn't have: the `new` operator appears in (almost) all actions which set the value of `new.target`. Its visual continuity reinforces the meaning of the meta-property.

I think instead of `function.[meta-property]` it should *really* be `().[meta-property]` - which means `[call operator].[meta-property]`. The round-bracket call operator is in many ways the counterpart to "new" (consider the coincidence that it is optional when "new" is used and no arguments are passed) whereas "function" is much less connected to the notion of calling, and is rapidly growing less connected to function object creation at all.

Also, consider the phrasing of the meta-properties: `().arguments` now means "the arguments that the () was given", which to my ears rings clearer than `function.arguments` "the arguments that this function instantiation (not the function object) was given". (And do you not think it looks a little too similar to `Function.arguments`, which is semantically *and* syntactically completely different?)

I'm not sure if it's possible in the grammar for these proposed names to become `().callee`, `().count`, `().arguments` etc. (insofar as the actual call and property access operators strongly resemble them), but I think it should be considered.


_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss
Reply | Threaded
Open this post in threaded view
|

Re: Proposal: Additional Meta Properties for ES7

Claus Reinke-2
In reply to this post by Allen Wirfs-Brock
>> Can you show an example of how callee is used with a fat arrow function?
> ((n)=>n>1? n*function.callee(n-1) : 1)

meta-level tools are powerful, which makes them ever so tempting.

They are too powerful to be used for tasks for which current
language-level tools are sufficient. Using a call-by-value
fixpoint combinator

    let fix = f=>x=>f(x=>fix(f)(x))(x)
    undefined

we can use plain functional abstraction instead of meta properties

    let f = self=>n=>n>1?n*self(n-1):1
    undefined

    fix(f)(6)
    720

    fix(f)(7)
    5040

(if you're worried about optimization, provide a built-in 'fix')

For concise methods, the problem is already solved by 'this',
isn't it?

    ({f(n){return n>1?n*this.f(n-1):1}}.f)(6)
    720

Like most powerful tempting things, referring to meta-levels comes
at a cost, even though that may not be immediately visible (ie no
lexical scoping, cannot extract as part of a function body). So the
easiest route (of introducing the most powerful feature) is not
necessarily the best route.

You're still working to get rid of anomalies that hamper functional
abstraction and composition (arrow functions help with 'this'; and
wasn't the missing toMethod an attempt to handle the newly
introduced 'super' special case?). I'm surprised to see everyone
so eager to introduce new trouble.

just saying... :-)
Claus
http://clausreinke.github.com/

 
_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss
Reply | Threaded
Open this post in threaded view
|

Re: Proposal: Additional Meta Properties for ES7

Andrea Giammarchi-2
and yet you haven't removed any anonymous arrow listener. Assign first? Mostly nobody will do that, it's just less natural then `obj.on(something, ()=>happening)`

On Fri, Feb 27, 2015 at 3:59 PM, Claus Reinke <[hidden email]> wrote:
Can you show an example of how callee is used with a fat arrow function?
((n)=>n>1? n*function.callee(n-1) : 1)

meta-level tools are powerful, which makes them ever so tempting.

They are too powerful to be used for tasks for which current language-level tools are sufficient. Using a call-by-value fixpoint combinator

   let fix = f=>x=>f(x=>fix(f)(x))(x)
   undefined

we can use plain functional abstraction instead of meta properties

   let f = self=>n=>n>1?n*self(n-1):1
   undefined

   fix(f)(6)
   720

   fix(f)(7)
   5040

(if you're worried about optimization, provide a built-in 'fix')

For concise methods, the problem is already solved by 'this',
isn't it?

   ({f(n){return n>1?n*this.f(n-1):1}}.f)(6)
   720

Like most powerful tempting things, referring to meta-levels comes
at a cost, even though that may not be immediately visible (ie no
lexical scoping, cannot extract as part of a function body). So the
easiest route (of introducing the most powerful feature) is not
necessarily the best route.

You're still working to get rid of anomalies that hamper functional
abstraction and composition (arrow functions help with 'this'; and
wasn't the missing toMethod an attempt to handle the newly introduced 'super' special case?). I'm surprised to see everyone so eager to introduce new trouble.

just saying... :-)
Claus
http://clausreinke.github.com/



_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss


_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss
Reply | Threaded
Open this post in threaded view
|

Re: Proposal: Additional Meta Properties for ES7

Allen Wirfs-Brock
In reply to this post by Leon Arnott

On Feb 27, 2015, at 12:27 AM, Leon Arnott wrote:

> I feel a little unhappy that one meta-property, `new.target`, is lexically scoped in arrow functions but these new ones aren't, without much obviously distinguishing them. I guess you could concoct the reasoning that since arrows can't be `new`'d, `new.[meta-property]` is "meaningless" in it - but that feels like the sort of explanation that makes more sense retrospectively.

Each meta property is its own special form with its own unique semantics.  Of course, consistency among similarly named meta properties is nice, but we have to balance that against the fact that we have a quite limited set of keywords available that we can use for forming meta properties.

>
> On a different tack: I also feel like `new.target` has a significant readability advantage which `function.[meta-property]` sadly doesn't have: the `new` operator appears in (almost) all actions which set the value of `new.target`. Its visual continuity reinforces the meaning of the meta-property.
>
> I think instead of `function.[meta-property]` it should *really* be `().[meta-property]` - which means `[call operator].[meta-property]`. The round-bracket call operator is in many ways the counterpart to "new" (consider the coincidence that it is optional when "new" is used and no arguments are passed) whereas "function" is much less connected to the notion of calling, and is rapidly growing less connected to function object creation at all.

The meta property syntactic pattern is:  <reserved word> . <IdentifierName> . Replacing <reserved word> with a sequence special characters is something that was not discussed when we adopted that pattern for new.target. However, past attempts assign special meaning to special character sequences have not been well received.
>
> Also, consider the phrasing of the meta-properties: `().arguments` now means "the arguments that the () was given", which to my ears rings clearer than `function.arguments` "the arguments that this function instantiation (not the function object) was given". (And do you not think it looks a little too similar to `Function.arguments`, which is semantically *and* syntactically completely different?)
>
> I'm not sure if it's possible in the grammar for these proposed names to become `().callee`, `().count`, `().arguments` etc. (insofar as the actual call and property access operators strongly resemble them), but I think it should be considered.
>

Allen
_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss
12