18:13
<shu>
did we ever talk about Math.fround on bigints? alon (who works on emscripten) reached out to me that as it is currently specced (float64->float32), trying to round BigInts to float32s requires accumulating rounding errors by first going to a float64
18:14
<shu>
i'm assuming this rounding behavior actually broke the compilation of some c/c++ code in emscripten
18:16
<devsnek>
we need to generally get bigint supported in math methods
18:16
<ljharb>
+1
18:16
<devsnek>
its on my list of proposals
18:16
<ljharb>
i haven't had time to get that together but will be happy to cochampion with whoever does
18:17
<devsnek>
https://snek.dev/proposal-list
18:18
<shu>
i am not sure all math methods make sense
18:18
<devsnek>
well not literally all of them
18:18
<devsnek>
wouldn't make much sense with Math.sin
18:19
<shu>
it's a fairly small subset actually
18:20
<shu>
the bitwise stuff, min/max, uh... sign, abs
18:21
<devsnek>
abs, cbrt, clz32, fround, imul, the logs, max, min, pow, sign
18:25
<shu>
sgtm
18:45
<Bakkot>
the logs are kinda weird because you often want a number out
18:45
<Bakkot>
most bigints in my code are such that log2(bigint) would be less than 2**53
18:45
<shu>
i assumed the logs would continue to output numbers
18:46
<shu>
it would be unusual to want integral logs, right?
18:49
<bradleymeck>
except for change of base?
18:49
<Bakkot>
dunno about that. integral log2 (rounded up) tells you how many bits are are in a thing.
18:50
<TabAtkins>
Yeah but you can just... round up, if you want that. I'd want the actual fp log of my bigint by default.
18:51
<Bakkot>
sure, just saying that integral logs are not unusual
19:01
<ljharb>
shu: it'd definitely be a case by case audit
19:02
<ljharb>
but anything where it makes sense, it should work
19:49
<TabAtkins>
just print the number and hold your ruler up to the screen if you want integral log, imo
21:39
<littledan>
> Private data that isn’t bad
21:39
<littledan>
devsnek: I would be interested in your thoughts on this
21:39
<devsnek>
i feel like i've vocalized my thoughts on private fields already :P
21:40
<littledan>
Oh sorry I guess I forgot what they were, if there was something additive. Do you have a reference?
21:40
<littledan>
(if not that's fine)
21:41
<devsnek>
i mean the tl;dr is i think they are a bad thing that doesn't fit the rest of the language
21:42
<littledan>
Right so I wasn't sure which part you might want to fix with a proposal
21:43
<devsnek>
something without new syntax and forced throwing
21:51
<littledan>
throwing?
21:52
<littledan>
shu: Curious why this comes up from JS and not just Wasm. I thought Math.fround was sort of an asm.js albatross at this point.
21:55
<devsnek>
littledan: they throw instead of returning undefined
21:56
<devsnek>
also the emscripten stdlib on the js side has to do various operations, i'd guess that's where the problem is
21:59
<littledan>
In which case (re private)?
22:04
<littledan>
I mean, it already does throw in a bunch of cases; that was a design goal. Do you mean how they're default-initialized to undefined as fields?
22:10
<devsnek>
littledan: no I mean I don't think they should throw if they don't exist on the receiver
22:10
<littledan>
oh, you meant *without* throwing, OK
22:11
<devsnek>
now that they are implementation reality one can only hope we can add all the features needed to make them usable
22:19
<littledan>
so, which features would those be?
22:19
<devsnek>
probably the simplest would be reifying them
22:20
<devsnek>
cuz then you could just use the value with `in` and as a computed lookup and add it to existing objects and delete it from things and etc
22:23
<devsnek>
you could do each one of those as its own bespoke feature but that gets into my point about composing with the language
22:37
<shu>
littledan: it came up in emscripten generated js fallback code
22:37
<shu>
so that aligns with your understanding