Re:Exotic Programming Ideas, Part 3: Effect Systems
by lalaithion on Sunday November 22, 2020 @04:48PM
(#25181408)
Nothing prevents having a type system capable of dealing with those problems. Yes, Java and Golang make this difficult, but if you have a language that supports it, there's nothing which prevents writing an API that says "Whatever the effects of the Callable you passed me are, I also perform those effects".
[ Parent
| on HN ]
Re:Exotic Programming Ideas, Part 3: Effect Systems
by skybrian on Sunday November 22, 2020 @05:17PM
(#25181642)
Introducing generic types doesn't make the function-coloring problem go away.
Now, instead of having a single function that has some effects, you have a family of closely-related functions, each with different effects. These functions are incompatible with each other. The function-coloring problem has gotten worse! :)
(Generic types are still useful though.)
Re:Exotic Programming Ideas, Part 3: Effect Systems
by lalaithion on Monday November 23, 2020 @12:48PM
(#25189422)
No, it doesn't make it go away, but it makes the "function coloring problem" about as much a problem as the "colors" of functions as determined by their return types. You can't pass a `func () string` to an api accepting a `func () int`.