Fibers Vs Generators

As Meteor has been using fibers.js a library that allows for coroutines is there any thought about whether this will be backed out in favor of generators which are semi-coroutines?

Meteor already supports async/await, which you’ll be aware uses generators with Promises to add in that functionality.

Having said that, I don’t believe there are any plans at the moment to remove Fibers from Meteor’s server-side code. However, Meteor’s Promises play nicely with Fibers, so you can mix-and-match.

I wrote a short series of articles on this. The first is this one, focusing on server code:

2 Likes

Fibers, as implemented in meteor, really provide a solution to the “function coloring problem” (http://journal.stuffwithstuff.com/2015/02/01/what-color-is-your-function/). In this respect, generators, typical coroutines and async/await aren’t as powerful as fibers as implemented in meteor.

Meteor basically achieved the most important end-user feature of Go, the transparent use of async IO in a synchronous style, for the most common use case, database calls. I think it would be a huge mistake use things that aren’t fibers. That’s actually where all the best backend design is going.

1 Like