Jorge <mailto:[email protected]>
January 20, 2012 7:15 PM

Sorry, I don't follow, with "that" you mean "something else" or "the acute accent" ?

Oh, not ' but the diacritical on é, you mean?

How do I type that on a US or UK keyboard? We are not going to use non-ASCII characters, so you are still barking up the wrong tree.

/be

str = ´agudo´
Error
• message: "Invalid character '\u0180'"
Brendan Eich <mailto:[email protected]>
January 20, 2012 6:59 PM
Jorge <mailto:[email protected]>
January 20, 2012 6:46 PM



1.- There are not quasi literals in the language yet

No, quasi-literals are approved for ES6. Already.

2.- quasi literals could as well use something else (the acute accent ?) instead

No, that is used for string literals, since JS1 in 1995!

3.- a shorter function syntax is almost at the top in the programmers' wish list for ES.next (unlike quasis)

So what? No one except you is asking for ` and quasis won. Please adjust your expecations accordingly.

Isn't it -perhaps- too soon to reject ` for functions in favor of quasis ?

No.

/be

Jorge <mailto:[email protected]>
January 20, 2012 1:22 AM

Has a backtick/accent grave ever been considered and/or rejected ?

Anonymous function expression:

setTimeout( '(){ ... }, 1e3);

Named function expression:

setTimeout( 'name(){ ... }, 1e3);

Declarations:

`(){ ... } // error: can't declare anonymous functions

`name(){ ... }
Brendan Eich <mailto:[email protected]>
January 19, 2012 11:27 AM
Axel Rauschmayer <mailto:[email protected]>
January 19, 2012 9:31 AM

Rationale: wouldn’t freezing by default be OK for 98% of the cases? If you want anything else, you can use a traditional function. Then the above syntax as the only function shorthand would be OK.


First, #(params) { body } was proposed by Arv and Alex:

http://wiki.ecmascript.org/doku.php?id=strawman:shorter_function_syntax

Arv and Alex feel strongly that the shorter function syntax (anything shortening 'function' syntax) must not freeze by default.

There was lack of clarity about whether completion value as implicit return value was part of the proposal. If so, controvery, since there is a completion value leak hazard. TC39 seems to agree the solution there is something with different look & feel, such as block-lambdas.

But, making a one-char grawlix shorthand for 'function' while still requiring 'return' is not considered enough of a shorthand. A possible cure here is to support an alternative body syntax: #(params) expr. However, this inverts precedence if done naively. It also runs into trouble trying to prefer an object literal over a block statement. I've worked on both of these in the context of

http://wiki.ecmascript.org/doku.php?id=strawman:arrow_function_syntax

This superseded shorter_function_syntax, but ran into grammatical issues that have vexed it.

But notice that throughout this, no one advancing a proposal advocated freezing by default. JS developers use function objects as mutable objects. Not just to set .prototype, also to decorate with ad-hoc and meta-data properties. Freezing is not wanted by default.

I agree that for block-lambdas it's easier to say "freeze by default". For merely "shorter function syntax", no. Functions are mutable objects by default in JS. This matters for minifiers, which may not be able to see all the mutations but would love to use shorter syntax for 'function' syntax, blindly.

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

Axel Rauschmayer <mailto:[email protected]>
January 19, 2012 9:31 AM

Rationale: wouldn’t freezing by default be OK for 98% of the cases? If you want anything else, you can use a traditional function. Then the above syntax as the only function shorthand would be OK.

--
Dr. Axel Rauschmayer
[email protected] <mailto:[email protected]>

home: rauschma.de <http://rauschma.de>
twitter: twitter.com/rauschma <http://twitter.com/rauschma>
blog: 2ality.com <http://2ality.com>

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

Reply via email to