This is the mail archive of the guile@cygnus.com mailing list for the guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: The GIMP! By gum, I forgot all about it!



forcer@mindless.com writes:
> On Thu, Oct 29, 1998 at 11:32:18PM -0500, Russell McManus wrote:
> >Scott Goehring <scott@poverty.bloomington.in.us> writes:
> >
> >> SIOD, or at least the SIOD in script-fu, lets you set! a previously
> >> unbound variable.  So (set! foo 5) is perfectly legal in script-fu,
> >> but raises an exception in guile.  Unfortunately, a number of
> >> script-fu script authors have made use of this anomalous behavior.
> >
> >Maybe this quick hack can be the beginning of a solution (guile
> >specific code):
> >
> >(define %set! set!)
> >(defmacro set! (name value)
> >  `(begin
> >     (if (not (defined? (quote ,name)))
> >	 (define ,name #f))
> >     (%set! ,name ,value)))
> 
> Uhm, why do you emulate define? :) (this does not solve the problem that
> SIOD's set! returns the new value though)
> 
> (define set! define)

Neither of these will DTRT, it has to set! if the variable is
_globally or locally_ bound, and define _at top level_, even if
nested, if not bound. See my posted version which will DTRT.

 - Maciej