Closed iacore closed 1 year ago
Not sure I understand the example your provided. I don't really get the effect
idea either.
What do you think this could bring to the table?
Reading from koka's doc, effects seem to be a strongly functional oriented language concept. Buzz is not really a functional language even though you can use it as such.
I'd argue also that what you propose is syntactic sugar:
protocol ReadValue {
fun readOne(<A>) > A;
}
fun willFail() > num !> ReadValue {
return readOne(); | Here I don't get your example: are you calling the ReadValue's method?
}
try {
num result = needEffect();
} catch (ReadValue effect) {
| not sure what you wanted to do here, `resume` is the keyword to continue a yielded fiber
}
Languages like smalltalk allow the program to continue from where the exception was thrown.
Algebraic effects allow you to do the same thing, but type checked. For example, it allows you to expose system API as an effect, then type check the program (make sure it only uses certain API).
Where all effects can be type-checked, there are no "side" effects.
Languages like smalltalk allow the program to continue from where the exception was thrown.
Interesting idea.
I'm not planning on adding any new features of that caliber though. Buzz should remain relatively simple.
With some changes, this language could support algebraic effects described in https://koka-lang.github.io/koka/doc/book.html.
catch
, allowresume
to continue from where exception was triggeredNew syntax: