[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Potential change in sample implementation - comments?
I'm thinking about adding and using a macro in the
to simplify the Scheme reference implementation.
Currently, the sample implementation includes
many lines that look like this:
; Run (n-expr-first port) and put results in various variables
(let* ((basic-full-results (n-expr-first port))
(basic-special (car basic-full-results))
(basic-value (cadr basic-full-results)))
I'm thinking about using an R5RS-style macro
so all such lines would instead look like:
(let-splitter (basic-full-results basic-special basic-value)
The macro definition would look like this:
; I'm intentionally requiring exactly 3 variables for now, since
; that's all that's used. It could be modified later to be more flexible.
((let-splitter (full first-value second-value) expr body ...)
(let* ((full expr)
(first-value (car full))
(second-value (cadr full)))
body ... ))))
Guile 1.8 doesn't enable R5RS macros by default, but they can be enabled with:
(use-syntax (ice-9 syncase))
It appears that the same is true for guile 1.6:
I believe most other Schemes in wide use have R5RS macros.
Even old/partial Schemes that did NOT support R5RS macros
should be easily adaptable (it doesn't particularly require a hygenic macro system).
I'd probably do the same with the Common Lisp implementation
(that's outside this group's scope, but I thought I'd mention it).
Comments? Good idea? Bad idea?
--- David A. Wheeler