irken-compiler icon indicating copy to clipboard operation
irken-compiler copied to clipboard

idea: simplified destructuring call syntax

Open samrushing opened this issue 6 years ago • 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?

samrushing avatar Oct 20 '19 22:10 samrushing