lang_2023/tests/classes.lang
2023-06-03 19:01:03 +03:00

59 lines
983 B
Text

struct \fruit =
| $apple
| $orange
| $banana
struct \optional 'a =
| $some & 'a
| $none
struct \result[#move] 'a 'b =
| & 'a
| $error & 'b
struct \complex[#value] =
& \float
& \float
struct \task =
& name : \string
& duration : \float?
class \employee =
& name : \string
& role :
( | $director
& importance : \float
& share : \float
| $manager
& productivity :
( \productivity
| $.low
| $.average
| $.high
& duration : \float
& sleep-on-work :
( \sleep-on-work
| $..yes
| $..no
))
& salary : \int
| $programmer
& skills : \float
& current-task : \optional[task]
& salary : \int)
class \bag =
&
( | $apple
| $orange
| $banana)
& bag-type :
( | $small
| $medium
& weight-kg : \int
& weight-g : \int
& weight-mg : \int
| $big)
& other-things : \array[something]