(Feature request) add a new match pattern to support txexpr
#7
Closed
opened 6 years ago by sorawee
·
4 comments
Loading…
Reference in New Issue
There is no content yet.
Delete Branch '%!s(<nil>)'
Deleting a branch is permanent. It CANNOT be undone. Continue?
I am a fan of
match
, but I do agree with your points at https://docs.racket-lang.org/txexpr/index.html#%28part..Why_not_just_use_match__quasiquote__and_so_on%29. However, there's a middle ground: add a new match pattern to supporttxexpr
.Would you be interested in adding this to the library?
I have also wanted this, although of course you want want
txexpr
as both a function and a match expander, more like this:By the way, I needed this enough (agreeing with that
match
+quasiquote
wasn't good enough) that I wrote this code when I wanted to parse MusicXml:b4489c27d7/music/util/txexpr.rkt (L12-L19)
(P.S. I'm thinking of making a pull-request, but I'm not sure how turning it into a macro like this affects the separate "safe" and "unsafe" versions, or how to handle providing a "macro with a contract" or a "match-expander with a contract")
I’d take PRs for this. I agree that macros & match expanders don’t need contracts. They can just be exported through
safe
as is.The problem is that the way I currently know how, even when
txexpr
is used as a function, it is not be protected by a contract. The issue is that the code the macro expands to is on the wrong side of the contract boundary.I might be able to fix this using
define-module-boundary-contract
...