On Mon, Aug 10, 2015 at 5:42 PM, joe joe...@gmail.com wrote:
Isn't this what switch statements are for? Perhaps a condensed operator
version of a switch would be useful?
if (a == 0 : 1 : 2) {
}
switch does eqeqeq comparison so is not exactly the same
`switch(1) { case true:
I one day writing js thought why there is no operator for ||= there should
be syntax makes sense, then i learned some ruby and it had this already.
Now i was convinced it makes sense afterall.
On Mon, Aug 10, 2015 at 1:15 PM, joe joe...@gmail.com wrote:
I actually like `[1, 2, 3, 4, 5,
I've had to track down vendor keywords to force C/C++ compilers to inline
functions
more than once, after the idiot thing's optimizers failed to do so, not even
when I was
using the inline keyword
Off topic, but remember that inlining isn’t always an optimization, and the
compiler’s
well
On Mon, Aug 10, 2015 at 6:15 PM, joe joe...@gmail.com wrote:
I actually like `[1, 2, 3, 4, 5, 6].contains(a)` better, too. The
question is, will engines actually optimize it.
if the entire environment never touches even by accident the
`Array.prototype` I don't see why that couldn't be
I actually like `[1, 2, 3, 4, 5, 6].contains(a)` better, too. The question
is, will engines actually optimize it. I have to admit, I don't trust
people who say VMs or compilers will do the optimizing for you. I've had
to track down vendor keywords to force C/C++ compilers to inline functions
Please search for older proposals on ecmascript.org. You'd find
http://wiki.ecmascript.org/doku.php?id=strawman:default_operator
ES6 parameter default values took a look of wind out of this one's sails.
/be
myemailu...@gmail.com wrote:
it could be used like this:
if ( a == 1 ||= 2 ||=3
Isn't this what switch statements are for? Perhaps a condensed operator
version of a switch would be useful?
if (a == 0 : 1 : 2) {
}
Or perhaps something similar to the set version, but without the set:
if (a of 1, 2, 3, 4, 5, 6) {
}
One could do this as a standard lib
On Mon, Aug 10, 2015 at 1:53 PM, Brendan Eich bren...@mozilla.org wrote:
Please search for older proposals on ecmascript.org. You'd find
http://wiki.ecmascript.org/doku.php?id=strawman:default_operator
ES6 parameter default values took a look of wind out of this one's sails.
You're
The original idea was a default assign operator, like CoffeeScript's `?=`.
And the idea of testing multiple values is currently best done with
`switch` statements. I would love a simpler alternative, though. (This is
something that engines could simply desugar, though, much like default
arguments
myemailu...@gmail.com wrote:
I one day writing js thought why there is no operator for ||= there
The problem with || (and, consequently, ||=) is that it uses ToBoolean.
We have all used to it, but I'd bet what we mostly want is if (x ==
null) ..., so I think ||= should NOT be added to the
Agreed.
On Mon, Aug 10, 2015, 20:41 Brendan Eich bren...@mozilla.org wrote:
Oops, sorry.
You were punning with pattern-matching there ;-).
Can this thread die?
/be
Tab Atkins Jr. wrote:
On Mon, Aug 10, 2015 at 1:53 PM, Brendan Eichbren...@mozilla.org
wrote:
Please search for older
I'm talking about cases where a failure to inline one function led to an
order of magnitude performance loss. As a general rule, I only inline
functions when I can demonstrate a measurable and significant performance
gain, for the reasons you listed. My point is just that you shouldn't
trust
Do you know *why* python gets away with that, though? It forcibly
amortizes the GC cost by using a hybrid reference counting/cyclic
collector scheme. That's not exactly fast, either, which is why no
one else does it.
On Mon, Aug 10, 2015 at 2:06 PM, Tab Atkins Jr. jackalm...@gmail.com wrote:
fwiw, just like String#includes, contains has been renamed to
Array#includes (see https://github.com/tc39/Array.prototype.includes/)
On Sun, Aug 9, 2015 at 8:41 PM, Isiah Meadows isiahmead...@gmail.com
wrote:
Or, there is the likely ES7 Array#contains for comparing multiple numbers.
```js
On Mon, Aug 10, 2015 at 3:50 AM, myemailu...@gmail.com wrote:
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)
Sounds like you want two operators;
Thanks I'll be searching through archive, and yea i think this is something
very simple and yet innovative.
On Mon, Aug 10, 2015 at 3:55 AM, Peter van der Zee e...@qfox.nl wrote:
On Mon, Aug 10, 2015 at 3:50 AM, myemailu...@gmail.com wrote:
Isn't
prop ||= 0;
better than
prop = prop ||
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
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
`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,
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,
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
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
22 matches
Mail list logo