guile-devel
[Top][All Lists]
Advanced

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

Re: illegal uses of define in guile


From: rm
Subject: Re: illegal uses of define in guile
Date: Tue, 15 Oct 2002 14:45:20 +0200
User-agent: Mutt/1.3.24i

On Mon, Oct 14, 2002 at 07:17:03PM +0200, Dirk Herrmann wrote:
> Hi,
> 
> (I have been quiet for some time because I was on vacation.)
> 
> with respect to defines and top level forms, I would like to point out the
> following issue (which may also be of relevance for the ideas you discuss
> in the file new-model.txt, Marius).
> 
> Currently, guile allows the following:
>   (if (not (defined? '%load-verbosely))
>       (define %load-verbosely #f))
> as can be found in r4rs.scm.
> 
> This is in contrast to R5RS (maybe even already in contrast to R4RS,
> but I haven't checked that).  Allowing such placements of define will make
> it impossible to determine statically whether after evaluation of the
> form the corresponding identifier will be bound or not.  That is, we
> should disallow this behaviour.

Hmm, doesn't the above imply that the side-effect' of 'define' is static?
What about code like the following:

  (use-module (ice-9 safe))

  (define my-context (current-module))

  (if some-weird-condition
      (set! my-context (make-safe-module)))

  ;; the side-effect of define here will depend on
  ;; the boolean interpretation of 'some-weird-condition'

  (eval (define car #f) my-context)

  ;; or, even meaner ...
  (define (nodefine sym val)
    (display "Safe environ: no (re)definition allowed!\n"))

  (eval (define  define nodefine) my-context)

Maybe a bit constructed but i can well imagine similar usefull situations.

 Ralf Mattes




reply via email to

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