Skip to content

Forward declare let? #795

Answered by Alasdair
Timmmm asked this question in Q&A
Nov 25, 2024 · 1 comments · 1 reply
Discussion options

You must be logged in to vote

We don't currently allow this. I think circular let-bindings would cause issues for some of our backends currently as they assume all the global let-bound constants can just be initialised in order (and some cases like below would just be impossible to handle). Also we might have issues with dependency cycles involving functions and forward-declared constants.

val x : int
val y : int

let x = 1 + y
let y = 1 + x

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Alasdair
Comment options

Answer selected by Timmmm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants