From: Marius Vollmer <mvo@zagadka.ping.de>
Cc: guile-devel@gnu.org
Subject: Re: What replaces scm_register_module_xxx (Doc update?)
Date: 21 Aug 2002 21:35:53 +0200 [thread overview]
Message-ID: <874rdot36u.fsf@zagadka.ping.de> (raw)
In-Reply-To: <Pine.GSO.4.05.10208170931560.12693-100000@sallust.ida.ing.tu-bs.de>
Dirk Herrmann <dirk@sallust.ida.ing.tu-bs.de> writes:
> I think it would be helpfull to explain that there is no relationship
> between modules named (a b) and (a b c).
Yes.
> > @deffn Procedure find-module name
> > @deffnx Setter (set! (find-module name) module)
> > The procedure @code{find-module} returns the module that has most
> > recently been registered with the name @var{NAME}. When no module has
> > been registered under @var{NAME}, return @code{#f}.
>
> I'd find it clearer when registering a module would be done using a
> function 'register-module' instead of using a setter.
Hmm, I was experimenting with the way Common Lisp does it. They have
'find-class' that is also a setter for registering classes. I don't
know yet whether I like it or not. The text that I posted is not a
serious proposal, only some loose ideas.
> > @c An environment is a mapping from identifiers (or symbols) to
> > @c locations, i.e., a set of bindings. There are top-level environments
> > @c and lexical environments. Environment in which a lambda is excuted is
> > @c remembered as part of its definition.
>
> What is the relationship between modules and top-level environments then?
They are identical. (Are they?)
> > You can only add to the set of bindings of a module, you can not
> > remove bindings. Also, you can only have a single binding for
> > each symbol in the set. As a consequence, once you have added a
> > local or imported binding to a module, it can not be changed.
> > Attempting to bind a symbol to the same object that it is already
> > bound to is silently ignored.
>
> With respect to modules this means that there is no undelete. Good. And,
> if this also applies to top-level environments, then memoization of
> variable locations can be used.
>
> > These rules ensure that a module can only evolve in a simple manner.
> > Once you have looked up a binding in a module, you can be sure that it
> > remains valid and that all lookups with the same symbol in a module
> > will return the same binding. When you need to make changes to a
> > module that are not allowed by these rules, you must abandon the old
> > module and create a new one. Modules that use the old module in some
> > way need to be reconstructed as well, and so on. See @pref{FIXME} for
> > more information about this.
>
> Hmmm. This needs to be clarified, especially with respect to memoized
> code.
Yes, this is actually the big point.
> > When Guile executes or compiles some code, it does this always in the
> > context of a module. That module is called the @dfn{current module}.
> > Set settable procedure @code{current-module} can be used to access the
> > current module. The global identifiers of the executed or compiled
> > code are looked up by finding the object that is bound to the
> > identifier symbol in the current module. In certain contexts, the
> > object must be a variable so that it can be referenced or set, in
> > others, it is also allowed to be a macro transformer which is then used
> > to expand the evaluated form.
>
> I think this paragraph is incorrect: Only when guile executes some
> top-level expressions the lookups are done in the current module.
Yes, exactly. I was only thinking about top-level forms, but haven't
said so explicitely.
> > To access bindings from another module, the desired bindings are
> > simply copied into the accessing module. There are several ways to
> > select which bindings to copy exactly and how to transform the symbols
> > on the way. Ultimately, however, imported bindings are added just
> > like local bindings.
>
> That means, modifying a value at the location of a binding will also
> modify the value for the source module.
Ahh, good point. I don't think we want to allow this. That is,
'define' will only reuse local bindings and will complain about
existing imported bindings. I had hoped that the distinction between
local and imported bindings doesn't need to be made...
> Ahh. Conflicting imports will result in errors. But: What happens if an
> imported binding is overwritten by 'define' in the current module?
> According to R5RS, in such a case 'define' becomes 'set!'. And this would
> influence the source module of the definition. Hmmm.
Yes, no good.
> Can one use the same module several times, every time specifying
> some different SELECTION and RENAMER? Can the same variable be
> imported several times under different names?
Yes, that is the intention, but I haven't thought about the consequences.
Thanks for your comments!
--
GPG: D5D4E405 - 2F9B BCCC 8527 692A 04E3 331E FAF8 226A D5D4 E405
_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel
next prev parent reply other threads:[~2002-08-21 19:35 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-08-08 13:48 What replaces scm_register_module_xxx (Doc update?) rm
2002-08-08 14:21 ` Dale P. Smith
2002-08-08 14:23 ` Dale P. Smith
2002-08-08 14:31 ` Rob Browning
2002-08-08 16:19 ` rm
2002-08-08 17:59 ` Dale P. Smith
2002-08-08 18:24 ` rm
2002-08-08 20:26 ` Marius Vollmer
2002-08-08 21:28 ` Neil Jerram
2002-08-09 15:36 ` rm
2002-08-17 11:59 ` Neil Jerram
2002-08-19 19:05 ` rm
2002-08-09 8:47 ` Matthias Koeppe
2002-08-09 10:00 ` rm
2002-08-09 11:29 ` Matthias Koeppe
2002-08-09 13:23 ` rm
2002-08-10 14:44 ` Marius Vollmer
2002-08-11 23:20 ` Marius Vollmer
2002-08-17 8:09 ` Dirk Herrmann
2002-08-17 11:05 ` Neil Jerram
2002-08-24 8:08 ` Dirk Herrmann
2002-08-26 21:45 ` Neil Jerram
2002-08-26 22:04 ` Marius Vollmer
2002-08-21 19:35 ` Marius Vollmer [this message]
2002-08-13 0:40 ` Marius Vollmer
2002-08-17 22:37 ` Dale P. Smith
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=874rdot36u.fsf@zagadka.ping.de \
--to=mvo@zagadka.ping.de \
--cc=guile-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).