GNU bug report logs - #10250
Problems using optargs with function docstrings

Previous Next

Package: guile;

Reported by: Peter TB Brett <peter <at> peter-b.co.uk>

Date: Thu, 8 Dec 2011 17:01:02 UTC

Severity: normal

Done: Andy Wingo <wingo <at> pobox.com>

Bug is archived. No further changes may be made.

Full log


Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Peter TB Brett <peter <at> peter-b.co.uk>
To: <bug-guile <at> gnu.org>
Subject: Problems using optargs with function docstrings
Date: Thu, 08 Dec 2011 11:01:30 +0000
There seems to be a nasty interference between the (ice-9 optargs)
module, Guile's support for function docstrings, and a function's
top-level definition context.

For example, the following works:

(use-modules (ice-9 optargs))
(define* (foo #:optional (bar "baz"))
(define (frob p) (display p) (newline))
(frob bar))
(foo)

with output:

baz

But when you add a docstring, it doesn't.

(use-modules (ice-9 optargs))
(define* (foo #:optional (bar "baz"))
"Docs go here"
(define (frob p) (display p) (newline))
(frob bar))
(foo)

This generates an error:

ERROR: In procedure memoization:
ERROR: Bad define placement (define (frob p) (display p) (newline)).

I'm not sure if this is a bug, but it looks like one to me. ;-)

Peter

-- 
Peter Brett <peter <at> peter-b.co.uk>
Remote Sensing Research Group
Surrey Space Centre




This bug report was last modified 13 years and 168 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.