34 ms·
> An effect system for Forth I have to confess that I don't know what exactly entails an "effect system", but Kitten trying to achieve something like that? ht
by vanderZwan 8y ago
> An effect system for Forth
I have to confess that I don't know what exactly entails an "effect system", but Kitten trying to achieve something like that?
http://kittenlang.org/ http://kittenlang.org/
- chriswarbo 8y agoAn effect system is like a type system, but keeps track of the 'effects' (think 'side effects', but we're doing them on purpose) that may occur when evaluating an expression. For example `print` might have a `log` effect. Unlike types, which get 'consumed' (e.g. by calling a function with an argument), effects tend to accumulate. I've mostly seen effect systems in the form of 'algebraic effect handling', which allow effects to be "handled" in a similar way to try/catch for (resumable) exceptions. For example, if we have an expression with the `log` effect, our tests might wrap it in a handler which just accumulates a string, so we can test what was logged; our production system might use a handler that plugs into an external logging system (which would require an effect like 'IO' or 'socket' or something). Stack languages like Forth and Kitten have "stack effects", which are the effects that evaluating an expression has on the stack, e.g. popping some values. Effects are sort of the inverse of capabilities: an expression with effect E tells us "evaluating this expression might result in E happening", whilst an expression with capability C says "to evaluate this expression, you must allow me to C".
- zeckalpha 8y agoAlso, Factor has an effect system like the one described: https://factorcode.org https://factorcode.org