The Gren Runtime
Gren code has some interesting properties:
- It can’t raise exceptions.
- It can’t change anything (variables, files, databases).
- Functions always return the same value for a given input.
This keeps your code simple, but how do you do anything?
Think about making an HTTP request. Normally, what happens would depend on what’s on the server, it could change something on the server, or even raise an exception. These are usually called “side effects”.
In Gren, side effects are handled by the Gren Runtime. Your application code can’t trigger side effects directly. Instead, it can tell the runtime what it wants to do using things called commands and subscriptions. The runtime can then send your application messages about the results of those side effects.
In the next sections you will see what this looks like in practice.