WIP optargs disaster

This commit is contained in:
Jan (janneke) Nieuwenhuizen 2020-12-30 16:58:32 +01:00
parent 5116f45fbb
commit ce94c4d3a2
No known key found for this signature in database
GPG Key ID: F3C1A0D9C1D65273
3 changed files with 15 additions and 22 deletions

View File

@ -59,16 +59,17 @@
(define-module (ice-9 optargs) (define-module (ice-9 optargs)
#:use-module (system base pmatch) #:use-module (system base pmatch)
#:replace (lambda*) #:export (lambda*
#:export-syntax (let-optional let-optional
let-optional* let-optional*
let-keywords let-keywords
let-keywords* let-keywords*
define* define*
define*-public define*-public
defmacro* defmacro*
defmacro*-public)) defmacro*-public
define-macro*))
;
;; let-optional rest-arg (binding ...) . body ;; let-optional rest-arg (binding ...) . body
;; let-optional* rest-arg (binding ...) . body ;; let-optional* rest-arg (binding ...) . body
;; macros used to bind optional arguments ;; macros used to bind optional arguments
@ -419,6 +420,9 @@
(defmacro* ,NAME ,ARGLIST ,@BODY) (defmacro* ,NAME ,ARGLIST ,@BODY)
(export-syntax ,NAME))) (export-syntax ,NAME)))
(define-macro (define-macro* NAME+ARGLIST . BODY)
`(define-macro ,(car NAME+ARGLIST) #f (lambda* ,(cdr NAME+ARGLIST) ,@BODY)))
;;; Support for optional & keyword args with the interpreter. ;;; Support for optional & keyword args with the interpreter.
(define *uninitialized* (list 'uninitialized)) (define *uninitialized* (list 'uninitialized))
(define (parse-lambda-case spec inits predicate args) (define (parse-lambda-case spec inits predicate args)

View File

@ -25,14 +25,4 @@
;;; Code: ;;; Code:
(mes-use-module (mes scm)) (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)
(include-from-path "mes/optargs.scm") (include-from-path "mes/optargs.scm")
(define-macro (define-macro* NAME+ARGLIST . BODY)
`(define-macro ,(car NAME+ARGLIST) #f (lambda* ,(cdr NAME+ARGLIST) ,@BODY)))

View File

@ -24,8 +24,7 @@ exec ${MES-bin/mes} --no-auto-compile -L ${0%/*} -L module -C module -e '(tests
;;; along with GNU Mes. If not, see <http://www.gnu.org/licenses/>. ;;; along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
(define-module (tests optargs) (define-module (tests optargs)
#:use-module (mes optargs) ;;#:use-module (ice-9 optargs)
#:use-module (mes mes-0)
#:use-module (mes test)) #:use-module (mes test))
(cond-expand (cond-expand