News for hackers. Stuff that matters.
Re:I Believe Zig Has Function Colors by anonymoushn on Saturday April 09, 2022 @08:17AM (#30967393)
You probably need at least one WriteJSON that's synchronous and one that's asynchronous, with different colors. If you want a version that uses memoization internally, it needs the "can allocate memory" color, which is independent of the async/sync color.
Re:I Believe Zig Has Function Colors by virchau13 on Saturday April 09, 2022 @09:58AM (#30968117)
Could it be possible to infer optional colors from the environment?

You denote that the color is optional in the function's type signature, and inside the body of the function, you have a construct that lets you execute different code depending on the state of the function's colors. The call site could either automatically infer the colors used or the colors used could be manually specified.

Basically a type parameter with compile-time if statements.

Re:I Believe Zig Has Function Colors by xigoi on Saturday April 09, 2022 @10:43AM (#30968463)
So, algebraic effects?