-
-
Notifications
You must be signed in to change notification settings - Fork 57
Open
Labels
RFCNew specifications of ErgNew specifications of ErgenhancementNew feature or requestNew feature or request
Milestone
Description
We propose new syntax for do/anonymous function block,
do { ... }
i -> { ... }
which is equivalent to
do:
...
i ->
...
This syntax makes it easy to pass blocks to a function.
foo do { ... }, i -> { ... }, j -> {
...
}, k -> {
... # no indentation allowed
}
The { immediately after do, ->(=>) is not considered to be the { of a brace container (set, record, dict).
i -> { i + 1 } # : Nat -> Nat
i -> { {i + 1} } # : Nat -> Set Nat
k = 3
do { i = 1; j = 2; k } # : () -> Nat
do { { i = 1; j = 2; k } } # : () -> { i = Nat; j = Nat; k = Nat }
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
RFCNew specifications of ErgNew specifications of ErgenhancementNew feature or requestNew feature or request