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: Dirk Herrmann
Subject: Re: illegal uses of define in guile
Date: Sat, 19 Oct 2002 17:22:03 +0200 (CEST)

Hi,

as far as I understand it, we want to further allow uses of define as in
the following situation:

> (if (not (defined? '%load-verbosely))
>     (define %load-verbosely #f))

You have convinced me, since I now have understood the following:  We must
be able to handle non-bound identifiers during compilation anyway.  Such
identifiers may legally become bound later, for example because of some
use of 'eval or 'load.  For example, the compiler has to be able to emit
code for

(define (foo) bar)

even if bar was not yet defined at that time.  Only when foo gets
evaluated, bar has to be defined.  Allowing

> (if (not (defined? '%load-verbosely))
>     (define %load-verbosely #f))

relies on this fact.  However, it even goes somewhat further:  It requires
that the executor must be able to handle definitions.

As said above, I agree that we can do this.  However, we should make one
thing sure:  Once a binding has been referenced, the binding itself should
never change.  Otherwise, memoizing lookups of identifiers in a top-level
environment could never be done (or would require to use some logic to
undo memoization whenever a binding changes).  IMO it is better to define
the system such that re-binding of identifiers is not allowed.

Summarized:
* The compiler must be able to emit code that allows references to
  identifiers to be looked up at use time (that is, in the executor).
* The executor must be able to handle definitions.
* Once a binding has been referenced, the binding should not change.

Best regards,
Dirk Herrmann





reply via email to

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