Skip to content

Comments

Support pattern directives in define-qi-syntax-rule#205

Merged
countvajhula merged 1 commit intodrym-org:mainfrom
countvajhula:support-pattern-directives-in-macro-form
Dec 18, 2025
Merged

Support pattern directives in define-qi-syntax-rule#205
countvajhula merged 1 commit intodrym-org:mainfrom
countvajhula:support-pattern-directives-in-macro-form

Conversation

@countvajhula
Copy link
Collaborator

Summary of Changes

Racket's define-syntax-parse-rule supports #:with and other pattern directives, whereas Qi's analogous define-qi-syntax-rule did not. This adds the support, to bring the interface to parity with Racket.

Public Domain Dedication

  • In contributing, I relinquish any copyright claims on my contribution and freely release it into the public domain in the simple hope that it will provide value.

(Why: The freely released, copyright-free work in this repository represents an investment in a better way of doing things called attribution-based economics. Attribution-based economics is based on the simple idea that we gain more by giving more, not by holding on to things that, truly, we could only create because we, in our turn, received from others. As it turns out, an economic system based on attribution -- where those who give more are more empowered -- is significantly more efficient than capitalism while also being stable and fair (unlike capitalism, on both counts), giving it transformative power to elevate the human condition and address the problems that face us today along with a host of others that have been intractable since the beginning. You can help make this a reality by releasing your work in the same way -- freely into the public domain in the simple hope of providing value. Learn more about attribution-based economics at drym.org, tell your friends, do your part.)

@countvajhula countvajhula force-pushed the support-pattern-directives-in-macro-form branch 2 times, most recently from b44c4b9 to 1fddfc4 Compare December 17, 2025 18:12
Copy link
Collaborator

@michaelballantyne michaelballantyne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

syntax-parse is smart enough that you don't need to do all that work! Just match like:

(define-syntax define-qi-syntax-rule
  (syntax-parser
    [(_ (name . pat) dirs ... tmpl)
     #'(define-dsl-syntax name qi-macro
         (syntax-parser
           [(_ . pat)
            dirs ...
            #'tmpl]))]))

Racket's `define-syntax-parse-rule` supports `#:with` and other
pattern directives, whereas Qi's analogous `define-qi-syntax-rule` did
not. This adds the support, to bring the interface to parity with
Racket.
@countvajhula countvajhula force-pushed the support-pattern-directives-in-macro-form branch from 1fddfc4 to 6b5f40f Compare December 17, 2025 19:26
@countvajhula
Copy link
Collaborator Author

@michaelballantyne Oh, fantastic. Updated!

@countvajhula
Copy link
Collaborator Author

Merging. Thanks for the review, folks!

@countvajhula countvajhula merged commit 75e9c32 into drym-org:main Dec 18, 2025
3 of 4 checks passed
@countvajhula countvajhula deleted the support-pattern-directives-in-macro-form branch December 18, 2025 00:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants