mirror of
https://codeberg.org/ProgramSnail/lang_2023.git
synced 2026-01-25 13:07:13 +00:00
debug
This commit is contained in:
parent
582ad5668e
commit
0d62ae0814
29 changed files with 99479 additions and 1166 deletions
69
tests/classes.lang
Normal file
69
tests/classes.lang
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
// ?? value - parametric classes ??
|
||||
|
||||
// struct fields/etc. accessible from everywere
|
||||
// class fields/etc. accessible only from namespace of class or class instance (from "methods")
|
||||
|
||||
// points at the beginning of constructor name - amount of needed constructor prefixes ?
|
||||
|
||||
// ?? how to make class compositons ??
|
||||
|
||||
struct Fruit =
|
||||
| Apple
|
||||
| Orange
|
||||
| Banana
|
||||
|
||||
struct Optional 'A =
|
||||
| Some & 'A
|
||||
| None
|
||||
|
||||
struct (Result : #Move) 'A 'B =
|
||||
| & 'A
|
||||
| Error & 'B
|
||||
|
||||
// struct (Complex : #Value) =
|
||||
// & Float(0.0)
|
||||
// & Float(0.0)
|
||||
//
|
||||
// struct Task =
|
||||
// & name("Task") : String
|
||||
// & duration(0.0) : Float
|
||||
|
||||
class Employee =
|
||||
& name : String
|
||||
& role :
|
||||
( | Director
|
||||
& importance : Float
|
||||
& share : Float
|
||||
| Manager
|
||||
& productivity :
|
||||
( Productivity
|
||||
| .Low
|
||||
| .Average
|
||||
| .High
|
||||
& duration : Float
|
||||
& sleep_on_work :
|
||||
(SleepOnWork
|
||||
| ..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_g : Int
|
||||
| Big)
|
||||
& other_things : Array Something
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue