Readit News logoReadit News
mbrock · 8 days ago
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...

mbrock · 7 days ago
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.