unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* (debug-options 'full) is broken
@ 2009-06-09 19:27 Mark H Weaver
  2009-06-09 21:58 ` Andy Wingo
  0 siblings, 1 reply; 2+ messages in thread
From: Mark H Weaver @ 2009-06-09 19:27 UTC (permalink / raw)
  To: guile-devel

According to node "User level options interfaces" of api-options.texi,
(debug-options 'full) should print a list of options, but it fails
with "ERROR: unbound variable: option-name".  The other options
interfaces (eval-options, read-options, print-options, traps) are
broken as well.

The problem is here, in boot-9.scm:

(defmacro define-option-interface (option-group)
  (let* ((option-name car)
	 (option-value cadr)
	 (option-documentation caddr)

	 ;; Below follow the macros defining the run-time option interfaces.

	 (make-options (lambda (interface)
			 `(lambda args
			    (cond ((null? args) (,interface))
				  ((list? (car args))
				   (,interface (car args)) (,interface))
				  (else (for-each
                                         (lambda (option)
                                           (display (option-name option))
                                           (if (< (string-length
                                                   (symbol->string (option-name option)))
                                                  8)
                                               (display #\tab))
                                           (display #\tab)
                                           (display (option-value option))
                                           (display #\tab)
                                           (display (option-documentation option))
                                           (newline))
                                         (,interface #t)))))))
[...etc...]

How was this supposed to work?  How were the local bindings of
option-name, option-value, and option-documentation supposed to be
referenced from within the expansion of this non-hygienic macro?

    Mark


> Guile Scheme interpreter 0.5 on Guile 1.9.0
> Copyright (C) 2001-2008 Free Software Foundation, Inc.
> 
> Enter `,help' for help.
> scheme@(guile-user)> (debug-options 'full)
> 
> Backtrace:
> In unknown file:
>    ?: 0* [#<vm b7b876b8> #<program b7a9aef0 at standard input:0:0 ()>]
>    ?: 1* [debug-options full]
>    ?: 2* [for-each #<program 861bda0 (option)> (# # # # ...)]
>    ?: 3* [# #]
> 
> ERROR: In procedure module-lookup:
> ERROR: unbound variable: option-name
> scheme@(guile-user)> 




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: (debug-options 'full) is broken
  2009-06-09 19:27 (debug-options 'full) is broken Mark H Weaver
@ 2009-06-09 21:58 ` Andy Wingo
  0 siblings, 0 replies; 2+ messages in thread
From: Andy Wingo @ 2009-06-09 21:58 UTC (permalink / raw)
  To: Mark H Weaver; +Cc: guile-devel

On Tue 09 Jun 2009 21:27, Mark H Weaver <mhw@netris.org> writes:

> According to node "User level options interfaces" of api-options.texi,
> (debug-options 'full) should print a list of options, but it fails
> with "ERROR: unbound variable: option-name".  The other options
> interfaces (eval-options, read-options, print-options, traps) are
> broken as well.
>
> The problem is here, in boot-9.scm:
>
> (defmacro define-option-interface (option-group)
>   (let* ((option-name car)
> 	 (option-value cadr)
> 	 (option-documentation caddr)
>
> 	 ;; Below follow the macros defining the run-time option interfaces.
>
> 	 (make-options (lambda (interface)
> 			 `(lambda args
> 			    (cond ((null? args) (,interface))
> 				  ((list? (car args))
> 				   (,interface (car args)) (,interface))
> 				  (else (for-each
>                                          (lambda (option)
>                                            (display (option-name option))
>                                            (if (< (string-length
>                                                    (symbol->string (option-name option)))
>                                                   8)
>                                                (display #\tab))
>                                            (display #\tab)
>                                            (display (option-value option))
>                                            (display #\tab)
>                                            (display (option-documentation option))
>                                            (newline))
>                                          (,interface #t)))))))
> [...etc...]
>
> How was this supposed to work?  How were the local bindings of
> option-name, option-value, and option-documentation supposed to be
> referenced from within the expansion of this non-hygienic macro?

Umm... Oops :) See, these things used to be "memoizing macros", the
thing that Guile's old defmacros were built on. I translated them to
defmacros, but, um, not very well, apparently ;-)

I'll see if I can push a fix. BTW I pushed something that might affect
the stack overflow issue, can you give that a try? I have one report of
it working where it didn't use to work.

Cheers,

Andy
-- 
http://wingolog.org/




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-06-09 21:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-09 19:27 (debug-options 'full) is broken Mark H Weaver
2009-06-09 21:58 ` Andy Wingo

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