RE: What do you think about a C# 6 like nameof() expression for JavaScript.

2015-08-09 Thread Ron Buckton
While its true most IDE's can search for references in strings, `nameof` takes some of the guesswork out of determining whether a substring that matches a symbol refers to the symbol or is merely part of the sentence. That said, `nameof` is primarily a convenience for an IDE. Ron Sent from my

Question about [[Enumerate]] and property decision timing

2015-08-09 Thread Yusuke SUZUKI
Hi forks, Recently, we implemented Reflect.enumerate in WebKit JSC. At that time, the question is raised When are the enumerated keys determined?[1] For example, var object = ...; var iterator = Reflect.enumerate(object); object.newKey = hello; // At that time, iterator.next() is not called

Re: please add orEqual operator

2015-08-09 Thread Michael A. Smith
I was going to suggest a Set, now that ECMA has them… http://www.ecma-international.org/ecma-262/6.0/index.html#sec-set-objects ```js if ((new Set([1,2,3,5]).has(a)) { // stuff } ``` On Sun, Aug 9, 2015 at 4:20 PM myemailu...@gmail.com wrote: it could be used like this: if ( a == 1

please add orEqual operator

2015-08-09 Thread myemailum14
it could be used like this: if ( a == 1 ||= 2 ||=3 ||=5) { //do something if a is either 1,2,3,5} and it could be used like this a || = 0 // a = a || 0 thanks ___ es-discuss mailing list es-discuss@mozilla.org

Re: please add orEqual operator

2015-08-09 Thread Alexander Jones
`a ||= b` looks like an in-place logical or, like `+=`. `a = a || b` would have very different semantics to that which you propose. In Python this would be written: ```python if a in [1, 2, 3, 5]: # stuff ``` In JS we have similar but slightly less semantic: ```js if ([1, 2, 3,

Re: please add orEqual operator

2015-08-09 Thread myemailum14
why create an array when there can be an operator. I think if we do survey people will like this, ||=, it's more expressive. On Sun, Aug 9, 2015 at 9:41 PM, Isiah Meadows isiahmead...@gmail.com wrote: Or, there is the likely ES7 Array#contains for comparing multiple numbers. ```js [1, 2,

Re: please add orEqual operator

2015-08-09 Thread myemailum14
Isn't prop ||= 0; better than prop = prop || 0; and it can be even defined like this. prop ||= var1 ||= var2 ||= 0; but then i dont know how we can use it ike this if (num == 3 ||=4 ||=6) On Sun, Aug 9, 2015 at 9:47 PM, myemailu...@gmail.com wrote: why create an array when there can be

Re: please add orEqual operator

2015-08-09 Thread Isiah Meadows
Or, there is the likely ES7 Array#contains for comparing multiple numbers. ```js [1, 2, 3].contains(value); ``` As for the operator proposed here, there's already an existing proposal for a safer version which doesn't coerce: http://wiki.ecmascript.org/doku.php?id=strawman:default_operator. On