-
Notifications
You must be signed in to change notification settings - Fork 28
Closed
Labels
Description
Just an idea.
Datatypes would be a generalization of tuples. Nonrecursive datatypes would be translated similar to tuples. Recursive datatypes would be translated similar to classes, but with some kind of reference counting to have automated deallocation. This is possible, because immutable datatypes cannot have cycles, and because datatypes will not be castable to int.
Some examples:
// could replace tuples:
data vec2 = vec2(real x, real y)
// can be generic and have cases:
data option<A> = Some(A a) | None
// can be recursive
data list<A> = Cons(A head, list<A> tail) | Nil
Discuss.