We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dyon supports a closures:
a := \(x, y) = x < y println(\a(2, 3)) // prints `true`
For capturing of variables from the closure environment, see grab expressions.
~ msg := "hi!" a := \(x, y) ~ mut msg = { msg = "bye!" x < y } println(\a(2, 3)) // prints `true` println(msg) // prints `bye!`
fn foo() -> { return \(x, y) = x < y }
fn main() { a := foo() println(\a(0)) } fn foo() -> { return \(x) = bar(x) } bar(x) = x + 2
a := {x: \(x) = x + 2} println(\a.x(0))
Use double underscore __ to use named argument syntax:
__
a := {foo__x: \(x) = x + 2} println(\a.foo(x: 0))
The following rules are how closures work currently in Dyon:
=
These rules are designed for:
The text was updated successfully, but these errors were encountered:
bvssvni
No branches or pull requests
Dyon supports a closures:
For capturing of variables from the closure environment, see grab expressions.
Use of current objects inside closures
Return a closure from a function
Call other functions from within a closure
Store a closure inside an object
Use double underscore
__
to use named argument syntax:Rules
The following rules are how closures work currently in Dyon:
=
declaration)These rules are designed for:
The text was updated successfully, but these errors were encountered: