Re:Ruby Methods Are Colorless
by dragonwriter on Wednesday July 24, 2024 @10:53AM
(#41057726)
> Knowing ahead of time which functions are async is a feature.
> It's a big neon sign that says "hey, this function call is expensive"
Async and expensive aren't the same thing.
> Also, a nitpick - you can call async functions from sync ones, you just can't access the return value.
That's a quirk of the particular async/await implementation in JS and not generally true of colored-function implementations. (Actually, since async/await is sugar for promises, you can actually, Iām pretty sure, both call and use syntactically async functions from ones which are syntactically not-async if you really want to, the code is just ugly.
> It's a big neon sign that says "hey, this function call is expensive"
Async and expensive aren't the same thing.
> Also, a nitpick - you can call async functions from sync ones, you just can't access the return value.
That's a quirk of the particular async/await implementation in JS and not generally true of colored-function implementations. (Actually, since async/await is sugar for promises, you can actually, Iām pretty sure, both call and use syntactically async functions from ones which are syntactically not-async if you really want to, the code is just ugly.