diff --git a/spec.md b/spec.md index 45ff57c..18cad58 100644 --- a/spec.md +++ b/spec.md @@ -51,7 +51,7 @@ value := 2 # `:=` mutates the cell print(Num.to_str(!value)) ``` -## (Almost) no function or operator overloading +## no confusing function or operator overloading all operators: - `Num + Num` (has overloads for fixed width number types) - `Num - Num` (has overloads for fixed width number types) @@ -132,6 +132,24 @@ def example6-error(): Option[Unit] { } ``` +## automatic return types +``` +def add(a: Num, b: Num) -> _ { + a + b +} +``` + +## templated generics +``` +def [a,b] add(a: a, b: b) -> _ { + a + b +} + +add(1,2) + +add(1,"2") # error: in template expansion of add[Num,List[Char]]: No definition for `Num + List[Char]` +``` + ## pattern matching ``` type Option[t] = 'None | 'Some t