-
Notifications
You must be signed in to change notification settings - Fork 18
Open
Description
Remove fun, and use val to declare functions (even functions that are recursive and/or have multiple arms). Introduce new nonrec keyword to explicitly specify that a value declaration or function declaration is non-recursive. After this change, rec is implicit if there is one or more argument, nonrec is implicit if there are no arguments.
For example,
fun factorial 1 = 1
| factorial n = n * (factorial (n - 1))becomes
val factorial 1 = 1
| factorial n = n * (factorial (n - 1))Currently, recursion works because fun desugars to let rec. After this change, rec would be implicit if there is one or more argument; nonrec would be implicit if there are no arguments.
The following is valid Standard ML and will remain valid Morel.
val x = "abc";
> val x = "abc" : string
val x = size x;
> val x = 3 : intIf we implement #307, val will become let, and the let ... end block will become { ... }.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels