1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-29 19:30:36 +02:00

Convert (ice-9 session) to use 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.
This commit is contained in:
Chris K. Jester-Young 2013-10-28 10:17:03 -04:00
parent 5b491e4f28
commit 0e07c94ef1

View file

@ -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))