You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Dyon uses mut to declare mutability. This appears in front of a function argument declaration or when calling a function that mutates the argument.
foo(mut a) mutates the argument a
foo(mut a) has function name foo(mut)
foo(mut a, b) has function name foo(mut,_)
foo(a, b) has function name foo
Local variables are mutable.
Mutability is not part of a type, but added to the function name inside parentheses, e.g.(mut,_). When adding an external function, the mutability information must be added as part of the function name.
Mutability propagates for arguments:
fnfoo(mut a){ ...}// `bar` requires `mut a` because it calls `foo(mut a)`.fnbar(mut a){foo(mut a)}
Multiple functions can use the same name if they have different mutability information. This reduces the need for "get", "set" and "mut" in function name:
Dyon uses
mut
to declare mutability. This appears in front of a function argument declaration or when calling a function that mutates the argument.foo(mut a)
mutates the argumenta
foo(mut a)
has function namefoo(mut)
foo(mut a, b)
has function namefoo(mut,_)
foo(a, b)
has function namefoo
Local variables are mutable.
Mutability is not part of a type, but added to the function name inside parentheses, e.g.
(mut,_)
. When adding an external function, the mutability information must be added as part of the function name.Mutability propagates for arguments:
Multiple functions can use the same name if they have different mutability information. This reduces the need for "get", "set" and "mut" in function name:
This is designed for:
The text was updated successfully, but these errors were encountered: