mfichman / jogo

High(er) performance compiled programming language with clean, powerful syntax
MIT License
6 stars 1 forks source link

Pattern matching/destructuring #78

Open mfichman opened 10 years ago

mfichman commented 10 years ago

Allow types to be destructured by their public properties. Example:

Circle < Value {
   radius Float
   foo private Float
}
Rect < Value {
   width Float
   height Float
}

main() Int {
   c Circle = Circle(10.0)
   (radius) = c

   r Rect = Rect(1.0, 2.0)
   (width, height) = r

   ret 0
}