3 ms·
I think you should state in the title that this is based on your personal definition of function coloring.
by pverghese 5y ago
I think you should state in the title that this is based on your personal definition of function coloring.
- ghoward 5y agoAuthor here. Maybe, but later in the post, I show that Zig does, in fact, fit Bob Nystrom's definition: > Third, async is, in fact, viral. The language reference says, >> Zig infers that a function is async when it observes that the function contains a suspension point. Async functions can be called the same as normal functions. A function call of an async function is a suspend point. > (Emphasis added.) > In other words, if you call an async function, your function gets a suspend point, which means that your function becomes async. > In fact, if you look at Bob Nystrom’s point 3, “You can only call a red function from within another red function,” this means that Zig fits point 3! > What Zig does differently than Bob Nystrom’s “hypothetical” language is that if it sees you call a red function from a blue function, it shrugs its shoulders, makes the blue function red, and does not tell you. This gives the appearance of being able to call red functions from blue functions while still only allowing red functions to call red functions.