02:59
<bakkot>
emscripten is pretty good now it turns out
03:01
<bakkot>
spent the weekend hacking together wasm/typescript bindings for z3 (the smt solver) and once I figured out how to deal with threads properly it all just worked
03:02
<bakkot>
js could definitely do with better multithreading primitives though
03:12
<Jack Works>
Like the shared structs proposal?
03:16
<bakkot>
yeah, and module blocks or whatever that proposal evolved into
03:16
<bakkot>
there is just not a good way to say "go do this work in another thread" right now
18:33
<Luca Casonato>
Do folks here have thoughts on JS's string split behaviour? It differs from essentially all other languages in that a string split with limited split count splits N+1 times, but returns N items, whereas most language standard libraries split N times and also return N items. This causes essentially all languages other than JS to return an N size array from an N size split, where the last item is the remainder string. In JS the last item is not the remainder, but the N'th item: everything after the N'th item is discarded.
18:33
<Luca Casonato>
This image illustrates the difference:
19:09
<shu>
seems like something we can't change at this point?
19:09
<shu>
if you have a new method, it has to contend with that the thing that people expect to behave the same as other languages is still named split
19:10
<Luca Casonato>
That is valid. Although the function that does what I expect is called SplitN in Go and splitn in Rust. So there is precedent for that behaviour having this name.
19:13
<Justin Ridgewell>
I actually think the JS behavior is better...
19:14
<Justin Ridgewell>
Eg, for '1.0.0'.split('.', 1) to "parse" the major version
19:15
<Luca Casonato>
The reason I like the non JS behaviour better, is that v.split(s, n).join(s) works always. And it makes stripping of prefixes really easy.
19:16
<Luca Casonato>
Proposal of how it could be fixed in a backwards compatible way (by either adding a new method, or an options bag to String.prototype.split: https://github.com/lucacasonato/proposal-proper-string-split
19:17
<Luca Casonato>
Eg, for '1.0.0'.split('.', 1) to "parse" the major version
You could still do that with the other behaviour, by doing '1.0.0'.splitn('.', 2)[0]