vitreo12 / omni

DSL for low-level audio programming.
https://vitreo12.github.io/omni/
MIT License
187 stars 6 forks source link

struct: default values for fields #137

Closed vitreo12 closed 3 years ago

vitreo12 commented 3 years ago
struct Vec:
    x = 1      #float
    y int = 1  #int
    z          #float

init:
    a = Vec()  #(1.0, 1, 0.0)
struct Something:
    a

struct SomethingElse:
    something = Something()

init:
    somethingElse1 = SomethingElse() #uses default
    somethingElse2 = SomethingElse(Something(1)) #uses explicit
struct Something:
    data1 = Data(100) #initialized Data
    data2 Data        #non-initialized Data

init:
    something1 = Something(data2 = Data(20))   #100 / 20
    something2 = Something(Data(10), Data(30)) #10 / 30