ammarbinfaisal / sahl

a programming language with channels and coroutines/threads
MIT License
9 stars 1 forks source link

custom types #30

Closed ammarbinfaisal closed 8 months ago

ammarbinfaisal commented 1 year ago

I am conflicted between rust like structs and impl. Or go like

type complex struct {
    i: double
    r: double
}

and if wanna name a tuple

type complex (double, double)
ammarbinfaisal commented 1 year ago

I am think instead of impl the values would be passed a ref by default. just like lists are passed by ref right now

ammarbinfaisal commented 1 year ago
struct Point {
    x: int,
    y: int 
}

and

enum Fruit {
    Apple,
    Mango,
    Orange,
    Other(int)
}

just like rust and there'd be impls and traits but no Copy/Clone/Send and we'd automatically handle all that and by default every type would be printable

ammarbinfaisal commented 8 months ago

ended up with haskell like type constructors. 😅