Skip to content

Latest commit

 

History

History
21 lines (11 loc) · 566 Bytes

mutability.md

File metadata and controls

21 lines (11 loc) · 566 Bytes

Mutability

Silicon is immutable by default. It even has immutable data-structures, tail call optimization etc.

I have yet to show how to make anything mutable in Silicon. There is a built in Annotation for mutability.

@name age = 32;
age += 1; //error 'age' is immutable

If we really need to mutate then

@name age:mut = 32;

Technically the full type is :mut:int for mutable integer

@name age:mut:int = 32;

Update 18-Jan-25

Syntax for mutability will likely change. age:mut[int] could be one way with type parameters (generics).