rhombus-prototype
rhombus-prototype copied to clipboard
Keyword Rest implementation
An implementation of https://github.com/racket/rhombus-prototype/pull/225 option A: Rests with & and ~&, Repetitions with ..., Strings with +&.
Things left to do:
- [x] Implement keyword-apply-like function calls with
~&keyword rest - [x] Document new features
- [ ] Test
~&keyword rest thoroughly - [x] Implement
&rest for more data constructors- [x] List exprs/binds with
[e, ..., & l]andList(e, ..., & l) - [x] Map exprs/binds with
{k: v, ..., & m} - [x] Map exprs/binds with
Map{k: v, ..., & m} - [x] Map expressions with
Map([k, v], ..., & l) - [x] Set expressions with
{e, ...+, & s} - [x] Set expressions with
Set{e, ...+, & s} - [x] Set expressions with
Set(e, ...+, & l)
- [x] List exprs/binds with
- [x] Implement empty map binding, usable for something like
{k: v, ..., & Map.empty} - [x] Resolve issues with
Map()and&rest not working the same way as{}and&rest (Map{}macro,Map()function with keys/values grouped together instead of alternating, no&rest inMap()binding for now, but with the possibility of resolving that in the future via entry-sequences suggested by @jackfirth) - [x] Resolve issues with matching
&rest of mutable data (~error, pattern-fail~, copy, ~or alias-slice?~) - [x] Implement
~&keyword rest for|alt functions - [x] Implement keyword arguments for
|alt functions, cooperating with~&keyword rest - [x] Check
raco expandon test cases like the one below with(#%app f temp8 temp7) - [ ] Test everything thoroughly
- [ ] Clean up code that ends up unused
- [x] Rebase / Fix merge conflicts
From the Rhombus meeting on 2022-08-18:
#lang rhombus
fun f(x, ~b):
b
fun g():
f(1, ~b: 2)
the expansion for g should ideally contain something like (if (#%app variable-reference-constant? (#%variable-reference f6)) (#%app f temp8 temp7) ....) in its body.