v0.0.8: no more mutability
This commit is contained in:
11
spec.md
11
spec.md
@@ -10,7 +10,6 @@ Most important ones:
|
|||||||
- `List[T]`: (linked-) list of `T`
|
- `List[T]`: (linked-) list of `T`
|
||||||
- `Char`: unicode codepoint
|
- `Char`: unicode codepoint
|
||||||
- `Unit`: nothing
|
- `Unit`: nothing
|
||||||
- `Cell[T]`: mutable cell of `T`
|
|
||||||
|
|
||||||
Advanced (uncommon) types:
|
Advanced (uncommon) types:
|
||||||
- `Int8`, `Int16`, ...
|
- `Int8`, `Int16`, ...
|
||||||
@@ -42,14 +41,6 @@ let name = "Max"
|
|||||||
let passw = "1234"
|
let passw = "1234"
|
||||||
```
|
```
|
||||||
|
|
||||||
## Mutability only via `ref`
|
|
||||||
```
|
|
||||||
let value = Cell.from(1)
|
|
||||||
print(Num.to_str(!value)) # !cell "observes" the cell
|
|
||||||
value := 2 # `:=` mutates the cell
|
|
||||||
print(Num.to_str(!value))
|
|
||||||
```
|
|
||||||
|
|
||||||
## no confusing function or operator overloading
|
## no confusing function or operator overloading
|
||||||
all operators:
|
all operators:
|
||||||
- `Num + Num` (has overloads for fixed width number types)
|
- `Num + Num` (has overloads for fixed width number types)
|
||||||
@@ -60,8 +51,6 @@ all operators:
|
|||||||
- `List[t] ++ List[t]`: list concatenation
|
- `List[t] ++ List[t]`: list concatenation
|
||||||
- `value :: t` (explicitly specify type of value, useful for down-casting structs, or just code readability; does not perform casting)
|
- `value :: t` (explicitly specify type of value, useful for down-casting structs, or just code readability; does not perform casting)
|
||||||
- `list[index]`
|
- `list[index]`
|
||||||
- `!cell`: "observe" a mutable value
|
|
||||||
- `cell := value`: mutate a mutable value
|
|
||||||
|
|
||||||
## non-nominal struct types
|
## non-nominal struct types
|
||||||
```
|
```
|
||||||
|
Reference in New Issue
Block a user