capturing {io} and promising invariants #1297
Replies: 2 comments 7 replies
-
|
Thanks for this post! |
Beta Was this translation helpful? Give feedback.
-
|
For this specific case, I think you could figure out a way to inline |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi everyone! I wonder if we can revisit the discussion about which functions/builtins capture io. Specifically, I remember discussing whether
panicshould capture io or not.I find it very annoying that it does. For example, most
mapandsetfunctions capture io because they sometimes panic when invariants are broken. For this reason, maps/sets can not be defined at the top-level, which can be useful sometimes.In contrast, holes
<>do not capture io, though they exhibit similar behavior at runtime. This is a bit inconsistent, no? To me, this just leads me to use<>instead ofpanicbecause I don't want to capture io everywhere.If we want to maintain io capturing for panic (and for holes?), we need a different solution for promising invariants. In Effekt code we often have cases where it is 100% clear that a certain branch will not be executed. For example:
Should we track everything via effects in this case, do we have other ways of managing invariants, or is panicking a good solution, even if {io} gets captured?
Beta Was this translation helpful? Give feedback.
All reactions