Revert "mes: un-defmacro optargs. WIP"
This reverts commit 5da527c540dc0e1481a010899233b4e806fe37da.
This commit is contained in:
parent
a8e8f0a1e3
commit
0fab33da36
|
@ -26,6 +26,9 @@
|
|||
|
||||
(mes-use-module (mes scm))
|
||||
|
||||
(define-macro (defmacro name args . body)
|
||||
`(define-macro ,(cons name args) ,@body))
|
||||
|
||||
(define-macro (set-procedure-property! proc key value)
|
||||
proc)
|
||||
|
||||
|
|
|
@ -85,12 +85,14 @@
|
|||
;; bound to whatever may have been left of rest-arg.
|
||||
;;
|
||||
|
||||
(define-macro (let-optional REST-ARG BINDINGS . BODY)
|
||||
(defmacro let-optional (REST-ARG BINDINGS . BODY)
|
||||
(let-optional-template REST-ARG BINDINGS BODY 'let))
|
||||
|
||||
(define-macro (let-optional* REST-ARG BINDINGS . BODY)
|
||||
(defmacro let-optional* (REST-ARG BINDINGS . BODY)
|
||||
(let-optional-template REST-ARG BINDINGS BODY 'let*))
|
||||
|
||||
|
||||
|
||||
;; let-keywords rest-arg allow-other-keys? (binding ...) . body
|
||||
;; let-keywords* rest-arg allow-other-keys? (binding ...) . body
|
||||
;; macros used to bind keyword arguments
|
||||
|
@ -106,10 +108,10 @@
|
|||
;;
|
||||
|
||||
|
||||
(define-macro (let-keywords REST-ARG ALLOW-OTHER-KEYS? BINDINGS . BODY)
|
||||
(defmacro let-keywords (REST-ARG ALLOW-OTHER-KEYS? BINDINGS . BODY)
|
||||
(let-keywords-template REST-ARG ALLOW-OTHER-KEYS? BINDINGS BODY 'let))
|
||||
|
||||
(define-macro (let-keywords* REST-ARG ALLOW-OTHER-KEYS? BINDINGS . BODY)
|
||||
(defmacro let-keywords* (REST-ARG ALLOW-OTHER-KEYS? BINDINGS . BODY)
|
||||
(let-keywords-template REST-ARG ALLOW-OTHER-KEYS? BINDINGS BODY 'let*))
|
||||
|
||||
|
||||
|
@ -231,7 +233,7 @@
|
|||
;; Lisp dialects.
|
||||
|
||||
|
||||
(define-macro (lambda* ARGLIST . BODY)
|
||||
(defmacro lambda* (ARGLIST . BODY)
|
||||
(parse-arglist
|
||||
ARGLIST
|
||||
(lambda (non-optional-args optionals keys aok? rest-arg)
|
||||
|
@ -376,10 +378,10 @@
|
|||
;; Of course, define*[-public] also supports #:rest and #:allow-other-keys
|
||||
;; in the same way as lambda*.
|
||||
|
||||
(define-macro (define* ARGLIST . BODY)
|
||||
(defmacro define* (ARGLIST . BODY)
|
||||
(define*-guts 'define ARGLIST BODY))
|
||||
|
||||
(define-macro (define*-public ARGLIST . BODY)
|
||||
(defmacro define*-public (ARGLIST . BODY)
|
||||
(define*-guts 'define-public ARGLIST BODY))
|
||||
|
||||
;; The guts of define* and define*-public.
|
||||
|
@ -410,13 +412,13 @@
|
|||
;; semantics. Here is an example of a macro with an optional argument:
|
||||
;; (defmacro* transmorgify (a #:optional b)
|
||||
|
||||
(define-macro (define-macro* NAME+ARGLIST . BODY)
|
||||
`(define-macro ,(car NAME+ARGLIST) #f (lambda* ,(cdr NAME+ARGLIST) ,@BODY)))
|
||||
(defmacro defmacro* (NAME ARGLIST . BODY)
|
||||
`(define-macro ,NAME #f (lambda* ,ARGLIST ,@BODY)))
|
||||
|
||||
(define-macro (define-macro*-public NAME+ARGLIST . BODY)
|
||||
(defmacro defmacro*-public (NAME ARGLIST . BODY)
|
||||
`(begin
|
||||
(define-macro* ,NAME+ARGLIST ,@BODY)
|
||||
(export-syntax ,(car NAME+ARGLIST))))
|
||||
(defmacro* ,NAME ,ARGLIST ,@BODY)
|
||||
(export-syntax ,NAME)))
|
||||
|
||||
;;; Support for optional & keyword args with the interpreter.
|
||||
(define *uninitialized* (list 'uninitialized))
|
||||
|
|
Loading…
Reference in a new issue