Defining a Symbol object to be use as a property object

2014-10-09 Thread L2L 2L
I've played around with Symbol. And from my understanding, they are use to define unique properties and variable --I'm still not fully knowledgeable on them, only what I read. So if you would like to give your summary of them, please feel free.--. My proposal is to be able to define an symbol

Re: `throw` as an expression?

2014-10-09 Thread John Lenz
Sure, but there is no pressing need here, "return" as an expression would be more interesting. Not that I'm asking for that. On Oct 9, 2014 4:50 PM, "Brendan Eich" wrote: > John Lenz wrote: > >> or a simple utility method >> > > Current keyword-anchored statement form does not require parens arou

Re: `throw` as an expression?

2014-10-09 Thread Isiah Meadows
It would be convenient for throw to be one. Maybe an idea would be to treat it similar to `void` or `delete`? If it were an expression, it could be parsed very similarly. Here's a potential use case even without all the other ES6 additions. ```js function foo(bar) { bar == null && throw new Type

Re: `throw` as an expression?

2014-10-09 Thread Brendan Eich
John Lenz wrote: or a simple utility method Current keyword-anchored statement form does not require parens around expression to evaluate and throw. /be ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss

Re: `throw` as an expression?

2014-10-09 Thread Nathan Wall
On Thu, Oct 9, 2014 at 4:57 PM, John Lenz wrote: > or a simple utility method > Promise.reject could be used. ```js asyncFunc() .then(count => count >= 0 ? count : Promise.reject(new Error(...))) .then(...) .catch(...) ``` Nathan ___ es-discuss maili

Re: arrow functions and dart

2014-10-09 Thread John Lenz
On Tue, Sep 23, 2014 at 4:19 AM, Caitlin Potter wrote: > We already have two (three? not sure about JSC) engines which implement > arrow functions, plus Traceur. > And Closure Compilers' ES6 -> ES5 support. :-). (shameless plug) > It seems silly to talk about changing the syntax at this poin

Re: `throw` as an expression?

2014-10-09 Thread John Lenz
or a simple utility method On Thu, Oct 9, 2014 at 6:35 AM, Andrea Giammarchi < andrea.giammar...@gmail.com> wrote: > probably not exactly the fat arrow usage you were looking for ... but it > makes it trivial to inline any sort of block > > ```js > asyncFunc() > .then(count => count >= 0 ? count

Re: `throw` as an expression?

2014-10-09 Thread Andrea Giammarchi
probably not exactly the fat arrow usage you were looking for ... but it makes it trivial to inline any sort of block ```js asyncFunc() .then(count => count >= 0 ? count : ()=>{throw new Error(...)}()) .then(...) .catch(...); ``` Regards On Thu, Oct 9, 2014 at 1:23 PM, Axel Rauschmayer wrote:

`throw` as an expression?

2014-10-09 Thread Axel Rauschmayer
Use case: With promises, the expression body form of arrow functions is so convenient. Alas, `throw` being a statement, you can’t use it there. For example, the following code is not syntactically legal: ```js asyncFunc() .then(count => count >= 0 ? count : throw new Error(...)) .then(...) .catc