Readit News logoReadit News
mythmon_ commented on Cap'n Web: a new RPC system for browsers and web servers   blog.cloudflare.com/capnw... · Posted by u/jgrahamc
kentonv · 3 months ago
You can define a stream like:

    interface Stream extends RpcTarget {
      write(chunk): void;
      end(): void;
      [Symbol.dispose](): void;
    }
Note that the dispose method will be called automatically when the caller disposes the stub or when they disconnect the RPC session. The `end()` method is still useful as a way to distinguish a clean end vs. an abort.

In any case, you implement this interface, and pass it over the RPC connection. The other side can now call it back to write chunks. Voila, streaming.

That said, getting flow control right is a little tricky here: if you await every `write()`, you won't fully utilize the connection, but if you don't await, you might buffer excessively. You end up wanting to count the number of bytes that aren't acknowledged yet and hold off on further writes if it goes over some threshold. Cap'n Proto actually has built-in features for this, but Cap'n Web does not (yet).

Workers RPC actually supports sending `ReadableStream` and `WritableStream` (JavaScript types) over RPC. I'd like to support that in Cap'n Web, too, but haven't gotten around to it yet. It'd basically work exactly like above, but you get to use the standard types.

---------------------

Exceptions work exactly like you'd expect. If the callee throws an exception, it is serialized, passed back to the caller, and used to reject the promise. The error also propagates to all pipelined calls that derive from the call that threw.

---------------------

The mapper function receives, as its parameter, an `RpcPromise`. So you cannot actually inspect the value, you can only pipeline on it. `friend.isBestFriend ?` won't work, because `friend.isBestFriend` will resolve as another RpcPromise (for the future property). I suppose that'll be considered truthy by JavaScript, so the branch will always evaluate true. But if you're using TypeScript, note that the type system is fully aware that `friend` is type `RpcPromise<Friend>`, so hopefully that helps steer you away from doing any computation on it.

mythmon_ · 3 months ago
I'll definitely be watching out for more built-in streaming support. Being able to throw the standard types directly over the wire and trust that the library will handle optimally utilizing the connection would make this the RPC library that I've been looking for all year.
mythmon_ commented on Show HN: I built library management app for those who outgrew spreadsheets   librari.io/... · Posted by u/hmkoyan
mythmon_ · 5 months ago
My biggest complaint with library management tools, and I think this applies to Librari as well, is the lack of multi-user support. I have a lot of books in my "home library", spread out over a few rooms. But I'm not the only person interacting with this library. Their are books on the shelves that "belong" to other people in the house, and we all joint manage the books. Sharing logins can work, but misses out on so many things that we would like to have.

My dream tool for this would allow multiple people to be "members" of a library, and be able to belong to multiple members themselves. They could collectively manage things like metadata, like what books are on the shelves, but could have individual things like ratings or tracking what they've read.

Plex is actually a really good example of this. I hope some day to find a tracker like that for my books.

mythmon_ commented on Shift-to-Middle Array: A Faster Alternative to Std:Deque?   github.com/attilatorda/Sh... · Posted by u/AttilaT
dehrmann · 9 months ago
> Unlike std::deque, which uses a fragmented block-based structure

I always assumed deque implementations were ring buffers that double in size once full so that prepend/append operations are amortized O(1).

mythmon_ · 9 months ago
That's what I learned in my university data structures course. I don't know anything about C++'s std::deque though.
mythmon_ commented on Tell Mozilla: it's time to ditch Google   mozillapetition.com/... · Posted by u/notpushkin
kevwil · 9 months ago
> Some argue that it's good to have an independent rendering engine. Here too Firefox plays no role at all. The only counter force to Google's web feature roadmap is Apple/Webkit, not Mozilla.

I'd like to understand this point better. Does Firefox use the Chromium engine under the hood?

mythmon_ · 9 months ago
It doesn't use Chromium. I think that their point is that Firefox's rendering engine, Gecko, can only have an impact on the rendering engine space proportional to its user base, which they have argued is insignificant.
mythmon_ commented on Observable 2.0, a static site generator for data apps   observablehq.com/blog/obs... · Posted by u/tmcw
kuatroka · 2 years ago
Thank you I wonder if for #3 there is a way of somehow to keep the data hidden and only let people see the chart without hacking their way to see the underlying data
mythmon_ · 2 years ago
During our early exploration, someone made a data loader that returned an entire svg of a chart, instead of the data for a chart. I think it was a headless browser running Observable Plot, but I imagine there are lots of ways to generate charts in a data loader.
mythmon_ commented on Observable 2.0, a static site generator for data apps   observablehq.com/blog/obs... · Posted by u/tmcw
chrisjc · 2 years ago
Can you link to the "data loader" API or perhaps even a "data loader" example implementation for something similar to malloy, duckdb, or any other DB/SQL data source/provider?

Would love to see it, thanks in advance!

edit: found it https://observablehq.com/framework/lib/duckdb

mythmon_ · 2 years ago
The docs for data loaders are here: https://observablehq.com/framework/loaders. The simple version is they are simply programs that write their output to standard out. Very Unixey. When those programs are referenced in client side parts of the JS, they are reactively run when in development, and prebuilt for deployment.

I don't think we have any full examples of using a database yet, but we have written a bit about using DuckDB via its Node bindings here: https://observablehq.com/framework/lib/duckdb

I imagine that either Malloy's CLI or its Python bindings would fit very well here.

mythmon_ commented on Observable 2.0, a static site generator for data apps   observablehq.com/blog/obs... · Posted by u/tmcw
mrtimo · 2 years ago
It would be really cool if you guys supported Malloy. Maybe you already do? https://www.malloydata.dev/
mythmon_ · 2 years ago
Observable engineer here. I haven't looked into Malloy much, but Framework's data loaders are very flexible. If you can write a script or binary that uses Malloy and writes to stdout, it can be a data loader. For example, although we use SQL a lot in our internal usage of Framework, Framework doesn't actually have any specific SQL support. We just use our database's normal bindings.
mythmon_ commented on Firefox 75: Ambitions for April   hacks.mozilla.org/2020/04... · Posted by u/skellertor
butz · 6 years ago
How do I change search engine from search bar? Before update there were icons with my saved search engines, but now they are nowhere to be seen.
mythmon_ · 6 years ago
Once you start typing the same icons should show up again. You can click on them to perform just that search with the selected search engine, or right click on it to make it the default.
mythmon_ commented on Firefox 71   hacks.mozilla.org/2019/12... · Posted by u/blendergeek
asymmetric · 6 years ago
Yes, see this[0] for example.

If memory serves me right, the TLDR is that the more typical release management system can cause certain features to not be released as soon as they're ready, because other features that should go in a major release are not ready yet.

By removing the semantic component of release numbers and releasing often, this does not happen. Feature ready -> shipped soon.

[0]: https://hacks.mozilla.org/2019/09/moving-firefox-to-a-faster...

mythmon_ · 6 years ago
I'd say that Firefox versions are mostly a unit of time now, since they aren't generally semantically meaningful in the way semver is. While working on Firefox, we often make plans that are delineated not in weeks, months, and quarters, but in Firefox releases and the nightly/beta/release cycle associated with them.
mythmon_ commented on Firefox 71   hacks.mozilla.org/2019/12... · Posted by u/blendergeek
MikeTaylor · 6 years ago
Did the FireFox people ever explain why they abandoned a more typical version numbering system and instead started releasing a new major version every couple of weeks?
mythmon_ · 6 years ago
The recent change to having a releaes every 4-5 weeks is a small modification of the existing practice of having a new version every 6-8 weeks.

The 6-8 week schedule is about a decade old now. It's original goals were to help ensure that unrelated features didn't block each other from releasing, and make releases more consistent, which helps localization, testing, and project management. In that regard I think it's been very successful.

It's probably not worth nitpicking a decade old decision though.

u/mythmon_

KarmaCake day144October 24, 2013View Original