Skip to content

Comment on Embedding Wren in Hare

Comments

I found Wren a few days ago too and I've been integrating it with Zig and having a blast!

You may have noticed that calling foreign methods from Wren really only works with wrenInterpret, and can't be used for reentrancy from wrenCall, making the whole foreign method system apparently rather useless for fiber event loops.

I switched from foreign method calls to doing yields with operation request values. Zig resumes a fiber by calling it, and gets back its next "foreign call" as the return value when it yields again. This works perfectly well.

It also inspired me to go further and let fibers yield whole batches of requests, almost like io_uring...

Um, just to not leave falsities where someone might find them: you can indeed call foreign methods from the method started by a wrenCall! But that foreign method can't then do another wrenCall.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.