Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

include pattern matching forms in more binding positions #36

Open
spdegabrielle opened this issue Jul 18, 2019 · 3 comments
Open

include pattern matching forms in more binding positions #36

spdegabrielle opened this issue Jul 18, 2019 · 3 comments

Comments

@spdegabrielle
Copy link
Sponsor Member

include pattern matching forms in more binding positions (e.g. define, let/for clauses) -
@samth 2 Oct 2012

@AlexKnauth
Copy link
Member

AlexKnauth commented Jul 19, 2019

Cross-reference with point (4) of #23, since the syntax of patterns affects whether they can be used unambiguously in things like optional-arguments with defaults in define, as @dedbox pointed out

@rocketnia
Copy link

If syntax-parse is merged with matching and matching is used for argument lists, then I think the syntax would change in a way that's something like this:

; before
(define (my-print [out (current-output-port)])
  ...)

; after
(define (my-print {~optional out #:defaults ([out (current-output-port)])})
  ...)

; after defining a `define-splicing-syntax-class` helper
; (or maybe it would be `define-splicing-class`)
(define (my-print {~opt out (current-output-port)})
  ...)

The ambiguity would have come from the original syntax's use of parens without a prefix operator inside them. The revision just adds ~opt to keep it clear why the parens are there.

@dedbox
Copy link

dedbox commented Jul 19, 2019

While I agree a pattern-friendly syntax for args with defaults would be good, I think making match patterns appear more like syntax patterns would be a mistake unless we also intend to unify the semantics (and consequent developer experience) of expansion and evaluation. See #23 for my rationale.

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

No branches or pull requests

4 participants