mirror of
https://codeberg.org/ProgramSnail/lang_2023.git
synced 2025-12-05 22:48:42 +00:00
70 lines
1.3 KiB
Text
70 lines
1.3 KiB
Text
|
|
// ?? 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
|
||
|
|
|