commit 1d24d51e2956de403af4ceca808e744b0a807a06
parent 99b03a2e38d9ec97d8ba3b5a8e837b2bf8deb11a
Author: Ryan Sepassi <rsepassi@gmail.com>
Date: Mon, 27 Apr 2026 12:28:33 -0700
docs: r7rs todo
Diffstat:
1 file changed, 124 insertions(+), 0 deletions(-)
diff --git a/docs/SCHEME1-R7RS-TODO.md b/docs/SCHEME1-R7RS-TODO.md
@@ -0,0 +1,124 @@
+# scheme1 R7RS TODO
+
+Lists the R7RS items we intend to add, the items we explicitly aren't adding,
+and rough implementation notes.
+
+## Interpreter changes
+
+### Reader
+
+- [ ] **`#(...)` vector literals.** Required by full vector support.
+
+### Runtime types
+
+- [ ] **Vector type.** New heap header (`HDR.VEC`?), inline length +
+ slot array. Tag stays `HEAP`.
+- [ ] **Multiple-values protocol.** Internal MV vector (or stack
+ convention) returned from `values`. Single-value contexts that
+ receive ≠1 values are an error.
+
+### Special forms / form fixes
+
+- [ ] **Single-arm `if`.** `(if t c)` returns unspec when test is `#f`
+ instead of segfaulting (eval_if path).
+- [ ] **`do`.** Iteration with init/step/test.
+- [ ] **`case-lambda`.** Pick first matching arity at call time.
+ Stored as a list of (formals body) clauses inside the closure
+ payload.
+- [ ] **`let-values`, `let*-values`, `define-values`.** Depend on the
+ MV protocol.
+- [ ] **Flat (one-level) quasiquote.** `(quasiquote ...)`,
+ `(unquote x)`, `(unquote-splicing xs)` evaluated at the single
+ template depth. Nested quasiquote is unsupported. Works on
+ lists today; extend to vectors when those land.
+
+### New primitives
+
+These can't be expressed in Scheme; they need new entries in
+`prim_table` (or new syscall wrappers).
+
+- [ ] **Vector core:** `vector?`, `make-vector`, `vector-length`,
+ `vector-ref`, `vector-set!`.
+- [ ] **Multi-values:** `values`, `call-with-values`.
+
+---
+
+## Prelude additions (`prelude.scm`)
+
+These are blocked on the new primitives above; once those land the
+prelude wrappers are straightforward.
+
+### Vectors (§6.8) — over the new vector primitives
+
+- [ ] **Constructor:** `vector` (variadic).
+- [ ] **List/string conversion:** `vector->list`, `list->vector`,
+ `vector->string`, `string->vector`.
+- [ ] **Bulk:** `vector-copy`, `vector-copy!`, `vector-append`,
+ `vector-fill!`.
+- [ ] **Higher-order:** `vector-map`, `vector-for-each`.
+
+---
+
+## Permanent deviations (won't add)
+
+These are deliberate omissions — document them in user-facing notes
+rather than tracking them as TODOs.
+
+Out of scope:
+- §6.2 numerics — keep fixnum.
+- §4.3 macros / `define-syntax` / `syntax-rules` / `let-syntax` /
+ `letrec-syntax`.
+- §5.6 libraries / `define-library` / `import` / `export` / `cond-expand`.
+
+---
+
+### Types
+
+- Distinct `char` type (chars are fixnum bytes).
+- Distinct R7RS port type (we have a prelude `port` record over fds).
+- `promise`, `parameter`, `continuation`, `error-object`,
+ `environment`.
+
+### Forms
+
+- Internal `define` — interpreter raises an explicit error; users
+ must use `letrec`.
+- `delay`, `delay-force`, `force`, `make-promise`, `promise?`.
+- `make-parameter`, `parameterize`.
+- `guard` as an exception form (the `guard` keyword is reserved for
+ `pmatch` sub-clauses only).
+- `dynamic-wind`.
+- `include`, `include-ci`. (Source concatenation is shell-side.)
+- Nested quasiquote.
+- Block comments `#| ... |#` and datum comments `#;`.
+
+### Procedures
+
+- `utf8->string`, `string->utf8`.
+- All exception procs: `raise`, `raise-continuable`,
+ `with-exception-handler`, `error-object?`, `error-object-message`,
+ `error-object-irritants`, `read-error?`, `file-error?`. (`error`
+ itself stays as scheme1's flush-and-exit.)
+- `call-with-current-continuation`, `call/cc`.
+- `eval`, `environment`, `scheme-report-environment`,
+ `null-environment`, `interaction-environment`.
+- The entire R7RS port surface (§6.13): `call-with-port`,
+ `current-input-port`, `current-output-port`, `current-error-port`,
+ `input-port?` / `output-port?` / `textual-port?` / `binary-port?` /
+ `port?` / `input-port-open?` / `output-port-open?`,
+ `with-input-from-file`, `with-output-to-file`, `open-input-file` /
+ `-binary-` / `open-output-file` / `-binary-`, `close-port` /
+ `close-input-port` / `close-output-port`, string ports
+ (`open-input-string`, `open-output-string`, `get-output-string`,
+ `open-input-bytevector`, `open-output-bytevector`,
+ `get-output-bytevector`), reader/writer procs (`read`, `read-char`,
+ `peek-char`, `read-line`, `read-string`, `read-u8`, `peek-u8`,
+ `u8-ready?`, `char-ready?`, `read-bytevector`, `read-bytevector!`,
+ `write`, `write-shared`, `write-simple`, `write-char`,
+ `write-string`, `write-u8`, `write-bytevector`,
+ `flush-output-port`, `newline`).
+- `load`.
+- `current-second`, `current-jiffy`, `jiffies-per-second`.
+- `features`, `emergency-exit`.
+- `char-ci=?` / `char-ci<?` / `char-ci>?` / `char-ci<=?` /
+ `char-ci>=?` (derive from `char-foldcase` if needed).