Moreover `undefined|0` is exactly 0. The `|0` is used in asm.js because it
explicitly declares the intent.
So again, no error in there ;-)
Regards
On Tue, Apr 28, 2015 at 1:58 PM, Andrea Giammarchi
andrea.giammar...@gmail.com wrote:
Now you read again the exercise and realize that's
So, ES6 Promises reflect a specific set of design decisions, including a
specific definition of same type that appears to exist solely for use by
Promise.resolve. All that design guarantees is that the object has an
certain specific internal slot whose value is tested in a specific way by
On Apr 28, 2015, at 4:21 PM, John Lenz wrote:
You would hope that the engines might be able to create these objects on the
stack but I don't think anyone does that yet and the result is a flood of
eden objects.
I would like to know I'm wrong about this.
did you see
I missed it, thanks.I know things will improve in time but I'm just
coming from a discussion with folks complaining about the performance of
generators and GC overhead in real code with Chrome and Firefox relative to
simple hand written loops.
On Tue, Apr 28, 2015 at 4:28 PM, Allen
You would hope that the engines might be able to create these objects on
the stack but I don't think anyone does that yet and the result is a flood
of eden objects.
I would like to know I'm wrong about this.
On Apr 27, 2015 4:59 PM, Allen Wirfs-Brock al...@wirfs-brock.com wrote:
On Apr 27,
Another option:
var map = new Map;
Array.from(mainn)
.map(c = c.toLowerCase())
.forEach(c = map.set(c, (map.get(c) | 0) + 1));
This kind of question is probably better left for StackOverflow, however.
___
es-discuss mailing list
I agree this is not about the ES6 spec. But the answers helped because I was
trying to understand ES6’s arrow function that is similar to lambdas.
Thanks.
From: Andrea Giammarchi [mailto:andrea.giammar...@gmail.com]
Sent: Tuesday, April 28, 2015 6:02 PM
To: Kevin Smith
Cc: Axel Rauschmayer;
Now you read again the exercise and realize that's impossible to have as
a piutfall ... no, I just used a KISS approach for what I can tell, no
pitfalls with one single surrogate could happen by specs.
Best Regards
On Tue, Apr 28, 2015 at 1:57 PM, Axel Rauschmayer a...@rauschma.de wrote:
With
The best I can come up with is a totally different, less functional approach:
```js
const s = 'mainn';
let map = new Map();
for (let ch of s) {
ch = ch.toLowerCase();
const prevCount = map.get(ch) || 0;
map.set(ch, prevCount+1);
}
```
On 28 Apr 2015, at 10:52 ,
Not sure why everyone went for the `Map` version when in JS every object is
basically the equivalent of a `Map` already :-)
```js
let m = Array.from(mainn).reduce((m,k) = ((m[k] = 1 + (m[k] | 0)), m),
{});
```
looks a win to me, if you need to check or drop chars from the string I
would probably
Sorry Axel, I was rushing, it sounded over-rude ... so, yes, Map are better
for words, **but** in this specific case it was about all chars/surrogate
pairs, that's why I've said Objects where safe ... plus the rest, reduce
also is very handy for this exact kind of things ;-)
But yes, if it was a
Le 26 avr. 2015 à 00:58, Kevin Smith zenpars...@gmail.com a écrit :
If we used x.constructor to determine the actual constructor, then someone
could just change the constructor property for x and fool someone who wrote
C.resolve(x) and expected to get an instance of C back.
Note that if
Domenic, Kevin: the concern about Reflect.construct seems misplaced, but
in any event, the issue C. Scott raises wants addressing on its own. WDYT?
Yeah, sorry for dwelling on Reflect.construct so much (it's in my mind for
other reasons).
So what would the ideal Promise.resolve semantics do?
There is an English problem here:
Let existingProp be the resulting of calling the [[GetProperty]]
internal method of go with argument fn.
Can the spec be made easier to read?
--
Garrett
@xkit
ChordCycles.com
garretts.github.io
personx.tumblr.com
___
Kevin Smith wrote:
So what would the ideal Promise.resolve semantics do? I'm not sure,
maybe use SpeciesConstructor instead of [[PromiseConstructor]]?
This removes the wart in my view, has no less integrity. C. Scott?
/be
___
es-discuss mailing
C. Scott Ananian wrote:
It seems to me that this is an incomplete feature that should have
been dropped from the spec.
Seems like.
I apologize for not noticing this sooner.
No need -- thanks for finding it.
Domenic, Kevin: the concern about Reflect.construct seems misplaced, but
in any
On Apr 28, 2015, at 1:08 PM, Kevin Smith wrote:
What is the use case for third argument to Reflect.construct?
The primary use case is emulating the super() call semantics in a Proxy
construct trap handler.
Allen
___
es-discuss mailing list
Hi,
I am using ES6 by transpiling. The features remind me of Java lambdas.
If I have a string 'mainn' then my map should contain this.
[a=1, i=1, m=1, n=2]
Java : Example. I may not need the TreeMap here.
String s = __mainn__.replaceAll([^a-z\\s], );
final MapCharacter, Integer count =
2015-04-28 5:01 GMT+02:00 Kevin Smith zenpars...@gmail.com:
Looking over the Reflect namespace, I also see that Reflect.get and
Reflect.set have been given powers not expressible with syntax: the
receiver does not have to be a prototype parent of the target.
Did you mean the receiver does
Would `new Map(maps.reduce((e, m) = e.concat(Array.from(m)), []))` not
create a new Map from merging an array of `maps`? (It relies on the
`Map.prototype.[Symbol.iterator]` which is `Map#entries`, and the
`iterable` argument of the `Map` constructor)
On Tue, Apr 28, 2015 at 6:06 AM, Andrea
On Apr 27, 2015, at 8:01 PM, Kevin Smith wrote:
x = Reflect.construct(Promise, x, C);
is another fine way to fool someone who wrote C.resolve(x) and expected to
get an instance of C back.
Thanks for pointing this out. I believe the ability to use an arbitrary
newTarget parameter for
It could be something like this. But if this is done internall then we don't
need code to explicitly manipulate the Map.
let m = new Map();
m.set(x,1);
//set other keys
//for (let value of m.entries()){
//if (Object.keys(m).every((key) = m[key] == value[key])){
//Merge
//}
//}
On Tue, Apr 28, 2015 at 2:41 PM, Allen Wirfs-Brock al...@wirfs-brock.com
wrote:
So, ES6 Promises reflect a specific set of design decisions, including a
specific definition of same type that appears to exist solely for use by
Promise.resolve. All that design guarantees is that the object has
23 matches
Mail list logo