~repos /plum
git clone https://pyrossh.dev/repos/plum.git
A statically typed, imperative programming language inspired by rust, python
dc1e5efc
—
pyrossh 1 year ago
add static functions on records
- example/fn.mi +3 -0
example/fn.mi
CHANGED
|
@@ -32,6 +32,9 @@ record Cat(
|
|
|
32
32
|
age: int
|
|
33
33
|
)
|
|
34
34
|
|
|
35
|
+
fn Cat.WithName(name: str) =
|
|
36
|
+
Cat(name: name, age: 0)
|
|
37
|
+
|
|
35
38
|
fn (c: Cat) fullname(): str =
|
|
36
39
|
c.name + c.age.to_str()
|
|
37
40
|
|