3 ms·
It's only a question if the function needs to call something else that could be either color. The vast majority of code does not. It would take a couple months
by hctaw 6y ago
It's only a question if the function needs to call something else that could be either color. The vast majority of code does not.
It would take a couple months of bike shedding syntax and discussing internals but I feel like there's a version of this (applied to other function colors) that allowed a library author to annotate/decorate a function for an inclusive or exclusive set of these decorations the compiler can pick to call from a calling context, and allow the function author to specialize over the combination of decorators that actually get called. Since the set of decorators is small (I can only think of 2-3, including async) this feature would be straightforward to implement albeit potentially verbose.
There's a fancy compiler pass to make async work though. You need a special control flow analysis to figure out yield points in async bodies, since this new syntax would have no await.
It's probably too late for that. It might be implemented in terms of HKT.