Comments (3)
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.
from rhombus-prototype.
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
from rhombus-prototype.
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.
from rhombus-prototype.
Related Issues (20)
- Evaluation of subexpressions in `Any.of` HOT 2
- Weird interaction of namespace extension and import HOT 2
- Dark theme hides commented colons HOT 2
- Tracker for potential small additions
- Should multiple-value static infos live under a key? HOT 1
- Is `export` in `meta` supposed to work?
- `super` outside of a class uses wrong syntax object for error
- identifiers with dots in them HOT 4
- Module-path operators confuse Check Syntax
- `values` reducer incorerctly propagates initial-value static info HOT 3
- Improve static error for incorrect arities of subclass constructors HOT 1
- Some use of `Group` leads to “syntax class incompatible with this context”
- Alts after extra-indented blocks
- Not all macro options are allowed in pre-alts block position
- Scope pruning in Rhombus blocks
- arity error in annot.macro implementation HOT 2
- Eager expansion of definitions’ right-hand sides can be detected
- Unquoted matches are not available in the same pattern
- Use-site binder hygiene bug for `let` HOT 7
- A `let` before another `def` in the same block HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rhombus-prototype.