plum

#treesitter#compiler#wasm

git clone https://git.pyrossh.dev/plum

A statically typed, imperative programming language inspired by rust, python


dc1e5efpyrossh 2024-02-07T11:41:32+05:30
add static functions on records
Files changed (1) hide show
  1. 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