Support let bindings
It would be good to have let here as the special form that has proper sequencing.
Two proposed syntax:
-- option 1
foo :=
let bar := 3;
baz := 10;
in bar + baz;
-- option 2
foo :=
let {
bar := 3;
baz := 10;
}
bar + baz;
What should also work is
bar foo :=
let baz := foo + 10;
foo := foo + baz;
in foo + foo
where baz and foo refers to the passed foo. with foo also referring to the previously bound baz.
One thing one should also consider is let-rec blocks versus let blocks. In ocaml, you have let rec along with andto express recursion and dependencies respectively
In Common Lisp one has let vs let* for similar reasons. Having such distinctions allows for better idioms to form.
From here where anoma/juvix#1354 can be implemented as sugar ontop of let. Namely we can do ocaml style and between each value and shove it as a block on the top of the current compilation block.
I would however suggest that block syntax be fleshed out, Since the syntax feels very c inspired, {} may be the most natural choice for blocks but there are issues to over come even there.