Skip to content

Conversation

@illusory0x0
Copy link

No description provided.

@bobzhang
Copy link
Contributor

bobzhang commented Jul 3, 2025

we thought about this and it is not hard to implement, but the thing is that fn is important in MoonBit, many control flows like return needs know explict function boundary, try to hide fn seems not ideal

@illusory0x0
Copy link
Author

we thought about this and it is not hard to implement, but the thing is that fn is important in MoonBit, many control flows like return needs know explict function boundary, try to hide fn seems not ideal

This is a let operator so it shouldn't be treated as a function, and the let keyword doesn't handle return.

Although the let keyword can be decoded with lambda abstration and lambda application, it can't to use return.

for example

let foo : Int = {
  let y = 0 
  y + 1 // let can't use return
}

let bar : Int = (fn() {
  (fn(y){
    return y + 1 // here we can use return
  })(0)
})()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants