bug-guile
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Errors using `reload' command


From: Ludovic Courtès
Subject: Re: Errors using `reload' command
Date: Wed, 09 Feb 2011 10:51:04 +0100
User-agent: Gnus/5.110011 (No Gnus v0.11) Emacs/23.2 (gnu/linux)

Hi!

Andy Wingo <address@hidden> writes:

> On Tue 08 Feb 2011 23:58, Andy Wingo <address@hidden> writes:
>
>> On Thu 03 Feb 2011 20:18, Mark Harig <address@hidden> writes:
>>
>>> scheme@(guile-user)> ,re (ice-9 readline)
>>
>> Actually now this causes an infinite loop.  Doh.  We need defvar,
>> somehow...
>
> What do people think about this:
>
>     (define-syntax define-once
>       (syntax-rules ()
>         ((_ sym val)
>          (define sym (if (defined? 'sym) sym val)))))

Looks cool!

How about this variant?

    (define-syntax define-once
      (syntax-rules ()
        ((_ sym val)
         (define sym (if (defined? 'sym) sym val)))
        ((_ sym val docstring)
         (begin
           (define-once sym val)
           (set-doc-property! (module-variable (current-module) 'sym)
                              docstring)))))

Ludo’.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]