POC for "Syntactic sugar for destructuring patterns" or MATCH*? #773
Inc0n
started this conversation in
Cool Coalton Code
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I implemented a POC of what is a much welcomed feature to coalton as discussed in #280. And specifically from my comments onwards #280 (comment).
I would like to share my work with all of you.
fn* and match*
From the snippet above. The first is the base form
fn match*
, where the macromatch*
where transform itself into single nestedcoalton:match
(a good analogy ismatch*
is thelet*
version ofmatch
.fn*
andfn*-bare
are the two different syntax flavours overmatch*
, they are macros which expands to the first form. Personally I would preferfn*-bare
, I considered it to be cleaner.So which syntax to go with, or whatever nuances should be taken care of could come later. Perhaps there should be a macro
fn-macro*
that expands to thefn macro*
form instead or what not. So please share your opinions!The code is shown below (as of now, the macro
fn*-bare
is ommited):Code
EDIT1: added missing
reduce-match%
function.EDIT2: Some rewording,
Beta Was this translation helpful? Give feedback.
All reactions