eholk / harlan

A language for GPU computing.
Other
1.19k stars 82 forks source link

Allow destructuring in binding position #127

Open eholk opened 10 years ago

eholk commented 10 years ago

Unary ADTs is a pretty common pattern in Harlan as a way of getting structs and tuples. For these cases, it'd be nice to be able to destructure them in more than just match expressions, such as let and kernel. It'd be nice to do something like this:

(let (((point a b c) p))
  (+ a b c))

This would be equivalent to:

(match p
  ((point a b c) (+ a b c)))

It'd be especially nice for kernel parameters, for example.

This can probably be done mostly in the macro system.