19:33
<devsnek>
the idea of a way to get hashes for values in js is really growing on me
20:59
<bradleymeck>
Object.getHash = (o) => globalWeakMap.upsert(o, {insert: () => counter++})
21:10
<rickbutton>
can't put a primitive into a weakmap
21:12
<rickbutton>
what if Symbol.for took any primitive instead of just strings
21:13
<bradleymeck>
XD
21:14
<rickbutton>
although you can’t serialize it, if you need to serialize your hash
21:27
<ljharb>
rickbutton: you can serialize any non-symbol primitive yourself to a string, and make a symbol from that
21:27
<ljharb>
rickbutton: the es6-shim does that to make Map and Set lookups for primitive keys O(1)
22:17
<devsnek>
so engines have very different stack traces
22:17
<devsnek>
do people have preferences between them
22:19
<ljharb>
presumably each engine is very attached to their own, or they'd match another one's
22:22
<devsnek>
could be a web compat thing
22:22
<Bakkot>
it's a web compat thing
22:23
<ljharb>
for like, browser detection?
22:23
<ljharb>
i'd assume *each* browser's format is web compatible
22:23
<devsnek>
I'm guessing code employs a certain parsing based on the user agent
22:25
<Bakkot>
for parsing error stacks
22:25
<Bakkot>
you look at the UA and then pars the stack
22:26
<devsnek>
let's standardize Error.prototype.trace
22:26
<devsnek>
and an api so there's no parsing
22:27
<ljharb>
devsnek: that's what https://github.com/tc39/proposal-error-stacks is
22:27
<ljharb>
devsnek: but i was told that to hit stage 2, i first had to make a proposal that standardizes "exactly what .stack does now on all browsers"
22:27
<devsnek>
yeah I guess
22:27
<devsnek>
why not just give up on .stack
22:27
<devsnek>
and add something new
22:28
<ljharb>
you could certainly propose it, but i did not get the sense anyone was interested in that.
22:29
<devsnek>
I think that proposal uses a v8-like format
22:29
<devsnek>
if it's a web compat problem for browsers to switch, it probably won't happen either way
22:29
<ljharb>
afaik my proposal uses a format that allows for every browser's current unique format
22:30
<ljharb>
it just doesn't mandate "one of the precise existing formats", which was the ask
22:30
<ljharb>
(also it needs to mandate the contents)
23:48
<Bakkot>
does anyone have a copy of ieee754 (ideally 2019)? I want to see the definition of remainder