Re:Superfunctions: A universal solution against sync/async f...
by pomponchik on Monday July 21, 2025 @07:39AM
(#44634031)
Many old Python libraries got their mirrored async reflections after the popularization of asynchrony. As a result, the entire Python ecosystem was duplicated. Superfunctions are the first solution to this problem, which allows you to partially eliminate code duplication by giving the client the opportunity to choose (similar to how it is done in Zig) whether to use the regular or asynchronous version of the function.
[ Parent
| on HN ]
Re:Superfunctions: A universal solution against sync/async f...
by nine_k on Thursday July 24, 2025 @06:35PM
(#44677130)
But AFAICT in Zig you don't have to have async and sync versions. Instead, the runtime may choose to interpret `try` as an async or as a synchronous call, the latter is equivalent to a future / promise that resolves before the next statement [1]. This is a sane approach.
Having separate sync / async versions that look like the same function is a great way to introduce subtle bugs.