Remix.run Logo
IshKebab an hour ago

> Function coloring is specifically about requiring syntax for a function, eg. the async keyword.

It isn't really. It's about having two classes of functions (async and sync), and not being able to await async functions from sync ones.

It was originally about Javascript, where it is the case due to how the runtime works. In a sync function you can technically call an async one, but it returns a promise. There's no way to get the actual result before you return from your sync function.

That isn't the case for all languages though. E.g. in Rust: https://docs.rs/futures/latest/futures/executor/fn.block_on....

I think maybe Python can do something similar but don't quote me on that.

There's a closely related problem about making functions generic over synchronicity, which people try and solve with effects, monads, etc. Maybe people call that "function colouring" now, but that wasn't exactly the original meaning.