samrushing/irken-compiler

idea: simplified destructuring call syntax

samrushing opened this issue · 0 comments

This kind of thing is quite common:

(match (some-fun x) with 
  (thing:t (:tuple y z)) -> (use-y-z ...)
  )

i.e., there's only one pattern in the match, of a fixed type/structure.
It might be nice to have a syntax for doing this more compactly/cleanly.

Ideas:

(match (some-fun x) (thing:t (:tuple y z)) (use-y-z ...))
(some-fun x) -> (thing:t (:tuple y z)) -> (use-y-z ...)
(-> (some-fun x) -> (thing:t (:tuple y z)) (use-y-z ...))

I especially like the idea of chaining, but how useful in practice?