unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* Re: illegal uses of define in guile
@ 2002-10-19 15:22 Dirk Herrmann
  2002-10-19 15:44 ` Marius Vollmer
  2002-10-21 10:04 ` tomas
  0 siblings, 2 replies; 15+ messages in thread
From: Dirk Herrmann @ 2002-10-19 15:22 UTC (permalink / raw)


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



_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel


^ permalink raw reply	[flat|nested] 15+ messages in thread
* illegal uses of define in guile
@ 2002-10-14 17:17 Dirk Herrmann
  2002-10-14 17:49 ` Bruce Korb
                   ` (2 more replies)
  0 siblings, 3 replies; 15+ messages in thread
From: Dirk Herrmann @ 2002-10-14 17:17 UTC (permalink / raw)


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.

First, the code in r4rs.scm should be fixed.  However, I have not taken a
closer look at the way %load-verbosely is being used.  Maybe I will get to
this in the next time, but if someone else could take care of it, great.

Second, we should decide about how to deal with such forms.  Since guile
has allowed this before, there may exist code that makes use of this
feature.  It will, however, be difficult to support this feature as
'deprecated' when separating memoization and execution.

Best regards, 
Dirk Herrmann



_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel


^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2002-11-04 10:21 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-10-19 15:22 illegal uses of define in guile Dirk Herrmann
2002-10-19 15:44 ` Marius Vollmer
2002-10-21 10:04 ` tomas
2002-11-03 16:28   ` Marius Vollmer
2002-11-04 10:21     ` tomas
  -- strict thread matches above, loose matches on Subject: below --
2002-10-14 17:17 Dirk Herrmann
2002-10-14 17:49 ` Bruce Korb
2002-10-14 19:42   ` Neil Jerram
2002-10-15  0:18     ` Bruce Korb
2002-10-15  6:15       ` Dirk Herrmann
2002-10-15 10:49         ` tomas
2002-10-15 13:33         ` rm
2002-10-15 13:58         ` Bruce Korb
2002-10-15 12:45 ` rm
2002-10-18 21:55 ` Marius Vollmer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).