* [patch] Fix pmacro handling of default values when passed an empty arg list.
@ 2008-05-01 14:14 Doug Evans
0 siblings, 0 replies; only message in thread
From: Doug Evans @ 2008-05-01 14:14 UTC (permalink / raw)
To: cgen
Re:
* From: Joern Rennecke <joernr at arc dot com>
* To: cgen at sources dot redhat dot com
* Date: Thu, 18 Jan 2007 15:27:24 +0000
* Subject: bug when eliding arguments with default values?
I have some problem where I thougt an optional argument would be useful
for a macro that usually doesn't take an argument.
The actual code is a bit complex, so here is a stripped down example:
guile> (define-pmacro '(foo (arg1 . 1)) '(bar arg1))
guile> (pmacro-expand '(foo))
[...]
/pmacros.scm:99:3: In procedure error in expression (error (string-append # ":" ...) expr):
./pmacros.scm:99:3: standard input:13:wrong number of arguments to pmacro (foo arg1): ()
ABORT: (misc-error)
Maybe something like this,
2008-04-26 Doug Evans <dje@sebabeach.org>
* pmacros.scm (-pmacro-process-args): Fix handling of default values
when passed an empty arg list.
Index: pmacros.scm
===================================================================
RCS file: /cvs/src/src/cgen/pmacros.scm,v
retrieving revision 1.5
diff -u -p -r1.5 pmacros.scm
--- pmacros.scm 13 Jun 2005 22:28:30 -0000 1.5
+++ pmacros.scm 26 Apr 2008 18:23:07 -0000
@@ -148,7 +148,8 @@
; DEFAULT-VALUES.
(define (-pmacro-process-args arg-spec default-values args)
- (if (and (pair? args) (keyword? (car args)))
+ (if (or (and (pair? args) (keyword? (car args)))
+ (null? args))
(-pmacro-process-keyworded-args arg-spec default-values args)
args)
)
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2008-04-26 18:37 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-05-01 14:14 [patch] Fix pmacro handling of default values when passed an empty arg list Doug Evans
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).