evincarofautumn / kitten

A statically typed concatenative systems programming language.
http://kittenlang.org/
Other
1.09k stars 39 forks source link

Add the ability for user-defined types. #49

Closed 11Kilobytes closed 10 years ago

11Kilobytes commented 11 years ago

The title is self explanatory.

evincarofautumn commented 11 years ago

There are two things to do here: weak type aliases and proper user-defined types. Aliases are relatively simple but I have two competing ideas for user-defined types: unified ADTs or separate struct (labelled product) and union (sum) types. Either way, this depends on #33.

evincarofautumn commented 10 years ago

Monomorphic user-defined types are in:

data These:
  case This int;
  case That [char];
  case These int [char];

match (1 "foo" These):
  case This: sayInt
  case That: say
  case These -> x y:
    x sayInt
    y say

Their polymorphic cousins are on the way.