Comment by zarzavat

Comment by zarzavat 7 hours ago

1 reply

Exactly, there is nothing wrong with function coloring. It's a design choice.

Colored functions are easier to reason about, because potential asynchronicity is loudly marked.

Colorless functions are more flexible because changing a function to be async doesn't virally break its interface and the interface of all its callers.

Zig has colored functions, and that's just fine. The problem is the (unintentional) gaslighting where we are told that Zig is colorless when the functions clearly have colors.

gf000 4 hours ago

As mentioned, the problem with coloring is not that you see the color, the problem is that you can't abstract over the colors.

Effectful languages basically add user-definable "colors", but they let you write e.g. a `map` function that itself turns color based on its parameter (e.g. becoming async if an async function is passed).