I was looking for a good way to introduce new local scopes in Bolt. Currently, Bolt does not support this syntax.
The Solution
Syntactically similar to the do keyword in Haskell, this keyword introduces a new indented block. Semantically, it can be viewed as the { ... } syntax from Rust, because each item in the block will get evaluated from top to bottom.
let foo = x * do
let y = 2
y * y
foo 1 # evaluates to 4
This solution requires adjustments to the type checker and code generator.
The Problem
I was looking for a good way to introduce new local scopes in Bolt. Currently, Bolt does not support this syntax.
The Solution
Syntactically similar to the
do
keyword in Haskell, this keyword introduces a new indented block. Semantically, it can be viewed as the{ ... }
syntax from Rust, because each item in the block will get evaluated from top to bottom.This solution requires adjustments to the type checker and code generator.