AapoAlas

AapoAlas

@aapoalas.trynova.dev

Nova JavaScript engine developer and OSS contributor by day and night. Avid choir singer. He/him. Give me data-oriented design or else (I will cry). https://trynova.dev/

491 followers202 following1K posts

Internet, I need your help with #HTML, #JavaScript, #WebComponents, and printing! So you know how the print() method blocks while the dialog is open? How do you deal with that in an application where you have user expectations of a print button (to select what is being printed), and WebComponents?

View full thread

Doing that also takes a ton of time so it's not exactly efficient. The native browser print is lightning fast, but if you use print() to trigger it then you get blocking - and for some applications that is a critical safety issue. Conversely Ctrl+P does not allow for any async work before printing.

Is there any way to cut the Gordian Knot: get WebComponents to render correctly without complex de-shadowification logics, use the native browser print for speed, but avoid blocking the entire website while the user fiddles with their print settings?

Internet, I need your help with #HTML, #JavaScript, #WebComponents, and printing! So you know how the print() method blocks while the dialog is open? How do you deal with that in an application where you have user expectations of a print button (to select what is being printed), and WebComponents?

You can make a copy of the HTML (or the DOM structure and calculated styles) and open it in another window, but it will have to import the WebComponents to render them correctly: that requires JS, at which point CORS/CSP will stop you. Same thing with using pdfjs or equivalent.

Rewatching Hikaru no Go for the first time in ages (though I've read the manga every year or two) is such a nice experience <3 Makes me want to play again! But first I should finish my two go boards!

A smallish refactoring in a Node.js server application saved me 272 bytes per HTTP request. That's pretty nice, I think. Or at least it made me happy :)

TIL in C++ `BasClass&` can be created from a `Derived&`, thereby it does dynamic dispatch through the vtable instead of the reference being a guarantee that static dispatch is enough. Huh. This proves to be a mild issue with my C++/Rust interop crimes.

People don't change: in my Rust/C++ interop crimes I wanted to build an enum over "one-shot Request" vs "multi-response Request" even though both are just a C++ Request object at its core. An epiphany: this is what I always do in TypeScript as well! No wonder it felt so familiar and safe!

So lately I've been having obscene amounts of fun during absolutely hair-brained and -raising FFI crimes between Rust and C++. "Look ma, no C ABI!" Just going in raw, binding to C++ ABIs, inheriting C++ classes, creating C++ template instances like std::function's, all that good jazz direct in Rust.

So I'm taking a choir conductor camp, and in the same music camp is a man who is a total doppelganger of a coworker of mine, like not just looks similar but they really look like a clone sometimes! Turns out: they're identical twins. I guess that explains that.

AapoAlas reposted

The very first RustWeek 2026 badge!

Mara Bos@mara.bsky.social

Less than two weeks left! Tickets are selling rapidly, make sure to get yours before they sell out! 2026.rustweek.org If you aren't convinced yet, look at how cute our conference badges are: 🦀

So in other news today, I had a terrible/fun time with figuring out printing of WebComponent elements in response to a user button click without blocking the event loop! Can't use print() because it blocks, can't use iframe.src URL because it loses DOM state. Painful world out there!

AapoAlas reposted

I'm *very* excited to report that we got initial funding and have hired our first Rust maintainers! RustNL's Rust Maintainers Team starts out with two full time maintainers, one intern, and five part-time maintainers, now stably employed to continue their work on Rust! 🎉 rustnl.org/maintainers/

Mara Bos@mara.bsky.social

I'm excited to share what I've been working on with @erikjee.bsky.social: RustNL's #rustlang Maintainers Fund! Many people and companies contributing to Rust, but there are fewer and fewer paid positions for general maintenance (reviews,cleanups,etc). We need to fix that. bsky.app/profile/rust...

AapoAlas reposted

** Speaker announcement ** Aapo Alasuutari has proposed a project goal to make exclusive references buildable within the language. Hear the how, why(-nots), and what's to come at RustWeek 2026! Info & tickets: buff.ly/KExGb22 Utrecht May 18-23, 2026! @aapoalas.trynova.dev #rustweek2026 #rustlang

I want a reasonably fast ECMAScript RegExp engine using WTF-8 encoding built in #Rustlang, and preferably without JIT'ing for safety. Is that really too much to ask? /s

My #JavaScript SoA adventures are bearing fruit: a test creating a data flow graph of 750k nodes, 250k graph entry/exit points ("inputs"), and who knows how many inputs not participating in the graph, it takes <400ms to run. That's ~400ns per node or input, which is pretty cool I think!

Meh, none of my three talks made it past the sieve :D And I had such a banger topic line for one of the talks as well: "Data race you to UB!", I was really looking forward to giving that one. Better luck next time I guess!

Mara Bos@mara.bsky.social

After carefully reading and ranking a record number of 185 submissions from 148 speakers, we finally finished the talk selection for RustWeek 2026! I'm *really* excited about the lineup! Check it out here: 2026.rustweek.org/blog/2026-02... Don't forget to buy your ticket! See you in Utrecht!

ある親切な日本人がフロリダの自然に大変興味を持って、英語があまり出来なかったけれど一人で旅行することにしました。着いたら彼が皆に自然ツアーのことを尋ねて、無視されなっか場合必ず「ありがとう!ありがとう!」って言いました。 やっとあるツアーをやってくれる人を見つけて、2人で沼を見に行きました。沼に着いたらガイドは指差しで興味深いな所を指さして、日本語で「ありがとう」って言いました。日本人が近くに見に行きました。 わにでした。

Fun Finglish thing: "service" seems to conjugate to "servikse-", so it sounds like people are talking about the cervix. "Our cervix did great work in driving our EBITDA up!"

This weekend I've been (aside from suffering from a flu) having entertaining discussions and semi design sessions on in-place initialisation, out pointers, and such stuff in #Rustlang. It's really quite fun stuff to consider... Maybe there is a place for coroutines in all that as well?

Continuing on my crackpot theories of contravariant lifetimes, here's an interesting alternative formulation of Rust Pin: a pinned type holds a reference to itself (potentially inside a PhantomData). Moving the item invalidates that reference, so it invalidates the type.

It's possible to use this to write a Pinnable type today that wraps a T and only exposes Pin references to that T, but it's not sound because Pin requires that Drop is always called but Pinnable can be put into a ManuallyDrop to inhibit that.

Continuing on my crackpot theories of contravariant lifetimes, here's an interesting alternative formulation of Rust Pin: a pinned type holds a reference to itself (potentially inside a PhantomData). Moving the item invalidates that reference, so it invalidates the type.

That reference is (arguably, probably) contravariant; it can be covariant as well because we get invariance in either case, but contravariance I believe gives better semantics because conceptually the contravariant ref can never read self: hence taking &mut self is okay despite the self-reference.

trynova.dev/blog/garbage... Last Sunday I discovered that lifetimes on #Rustlang garbage collected handles should be contravariant on their lifetime parameter. This is an open research question, but I think this opens a path to meaningful lifetimes on self-referential structs. Check it out!

trynova.devGarbage collection is contrarian · NovaModeling unrooted handles to garbage collected data using contravariant lifetimes.
AapoAlas@aapoalas.trynova.dev

I'm being a total nutcase, but I found what I think is an important discovery about modeling garbage collected handles to the #Rustlang borrow checker: the lifetime of GC handles is contravariant! Instead of validity "rising up the call stack" it "droops down from the heap". Blog incoming!