summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris K. Jester-Young <cky944@gmail.com>2013-10-28 10:17:03 -0400
committerChris K. Jester-Young <cky944@gmail.com>2013-10-28 10:17:03 -0400
commit0e07c94ef11c772b8dec7111aa8cb14945874767 (patch)
tree8b92caaf719acd8193acb2964a23683b6871c340
parent5b491e4f2829d3644c1194c1dcccd320dd7c3ef6 (diff)
downloadguile-cky-hygienic-macros.tar.gz
Convert (ice-9 session) to use hygienic macros.cky-hygienic-macros
* module/ice-9/session.scm (help): Convert to syntax-rules. Also move most of the body into help-internal; help messages should not be displayed at macro-expansion time. (help-internal): New procedure.
-rw-r--r--module/ice-9/session.scm23
1 files changed, 11 insertions, 12 deletions
diff --git a/module/ice-9/session.scm b/module/ice-9/session.scm
index ce1bcac7c..039870700 100644
--- a/module/ice-9/session.scm
+++ b/module/ice-9/session.scm
@@ -78,19 +78,19 @@ handlers, potentially falling back on the normal behavior for `help'."
;;; Documentation
;;;
-(define-macro (help . exp)
- "(help [NAME])
+(define-syntax help
+ (syntax-rules ()
+ "(help [NAME])
Prints useful information. Try `(help)'."
- (cond ((not (= (length exp) 1))
- (help-usage)
- '(begin))
- ((not (provided? 'regex))
+ ((_ name) (help-internal 'name))
+ ((_ ...) (help-usage))))
+
+(define (help-internal name)
+ (cond ((not (provided? 'regex))
(display "`help' depends on the `regex' feature.
-You don't seem to have regular expressions installed.\n")
- '(begin))
+You don't seem to have regular expressions installed.\n"))
(else
- (let ((name (car exp))
- (not-found (lambda (type x)
+ (let ((not-found (lambda (type x)
(simple-format #t "No ~A found for ~A\n"
type x))))
(cond
@@ -143,8 +143,7 @@ You don't seem to have regular expressions installed.\n")
;; unrecognized
(else
- (help-usage)))
- '(begin)))))
+ (help-usage)))))))
(define (module-filename name) ; fixme: better way? / done elsewhere?
(let* ((name (map symbol->string name))