Posted by nnx 10 hours ago
the idea is basically just use functions. no classes and very little statefulness
But Observables really do not solve the problems being talked about in this post.
[1] https://github.com/WICG/observable [2] https://github.com/WICG/observable/issues/216
Sadly it will never happen. WebAssembly failed to keep some of its promises here.
classic case of not using an await before your promise
In an ideal world you could just ask the host to stream 100MB of stuff into a byte array or slice of the wasm heap. Alas.
for await (const chunk of stream) {
// process the chunk
stream.returnChunk(chunk);
}
This would be entirely optional. If you don’t return the chunk and instead let GC free it, you get the normal behavior. If you do return it, then the stream is permitted to return it again later.(Lately I’ve been thinking that a really nice stream or receive API would return an object with a linear type so that you must consume it and possibly even return it. This would make it impossible to write code where task cancellation causes you to lose received data. Sadly, mainstream languages can’t do this directly.)
> I'm not here to disparage the work that came before — I'm here to start a conversation about what can potentially come next.
Terrible LLM-slop style. Is Mr Snell letting an LLM write the article for him or has he just appropriated the style?
Just ctrl-f'ing through previous public posts, I think there were a total of 7 used across about that many posts. This one for example had 57. I'm not good enough in proper English to know what the normal number is supposed to be, just pointing that out.
It doesn't really matter what tools are used if the result is good
You might say well, it's on the Cloudflare blog so it must have some merit, but after the Matrix incident...
I would instead say that it is written by James Snell, who is one of the central figures in the Node community; and therefore it must have some merit.
I’ve read my fair share of LLM slop. This doesn’t qualify.
Possibly the LLM vendors could bias the models more toward nonprofessional content, but then the quality and utility of the output would suffer. Skip the scientific articles and books, focus on rando internet comments, and you’ll end up with a lot more crap than you already get.
Coalgebras might seem too academic but so were monads at some point and now they are everywhere.
https://github.com/ralusek/streamie
allows you to do things like
infiniteRecords
.map(item => doSomeAsyncThing(item), { concurrency: 5 });
And then because I found that I often want to switch between batching items vs dealing with single items: infiniteRecords
.map(item => doSomeAsyncSingularThing(item), { concurrency: 5 })
.map(groupOf10 => doSomeBatchThing(groupsOf10), { batchSize: 10 })
// Can flatten back to single items
.map(item => backToSingleItem(item), { flatten: true });