guile-devel
[Top][All Lists]
Advanced

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

Re: new-model.text, please comment


From: Marius Vollmer
Subject: Re: new-model.text, please comment
Date: 15 Sep 2002 00:05:08 +0200
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2

Neil Jerram <address@hidden> writes:

> Here are my few thoughts.  I don't have much experience or expertise
> in this area, so feel free to explain the obvious to me if that's what
> I've asked for :-)

Heh, I'm totally new to this stuff as well...

>     Marius> The output of the compiler is not specified.  Also,
>     Marius> execution of languages other than Scheme is not
>     Marius> considered.  It is assumed that additional languages are
>     Marius> first translated to Scheme (or whatever variant of Scheme
>     Marius> we offer) and then compiled normally."
> 
> High level thought -- is all of this new thinking necessary?  Are we
> unnecessarily ignoring useful stuff that has already been worked
> through on other projects?

Is there much new stuff in it?  I think what I have written down is
quite minimal, and very Guile specific as well.

>     Marius> When a module is created, the set of bindings is empty.
>     Marius> You can add bindings to the set, but you can not remove
>     Marius> them.  Existing bindings can not be changed.  There can be
>     Marius> at most one binding with a given symbol.
> 
> So it is impossible to change an existing macro definition?

Uhh, ohh.  That's what the rules say, but it's not what I intended.  I
think it is OK to change a macro definition, much as you can change a
function definition.  The text doesn't say what a macro transformer
really is.  We could just say that it is some kind of object that
contains a function.  The text does not allow the object to be
replaced by a different object, but the object can be modified (like
variables can be modified).

The alternative would be to change the rules and say that a macro
transformer can be replaced with a different macro transformer, but
that might not be as clean.

>     Marius> During compilation of a file that defines a module, that
>     Marius> module is partially constructed (via code executed by
>     Marius> eval-case).  The constructed module is made the current
>     Marius> module, but it is not registered in the system.  Requests
>     Marius> for a module with the name of the module-being-compiled
>     Marius> will not find the partially constructed module.  When the
>     Marius> compiler wants to follow a :module-ref statement with an
>     Marius> explicit name, it must check whether that name refers to
>     Marius> the partially constructed current module.
> 
> Don't understand the point here.  What are you trying to say by "will
> not find the partially constructed module"?

There is a global mapping from module names to module objects.  When a
module is created by executing a 'define-module' form, it is
registered in that global mapping so that 'use-modules' etc can find
it.  When a module is compiled, we need a compile-time representation
of the module, however, for keeping track of imports and macro
definitions, etc.  That representation can be a real module object,
but it would be wrong to register its name in the global mapping since
the module will only be partially constructed.

When a 'use-modules' form or equivalent is comiled, the referenced
module is loaded just as it would be loaded when the 'use-modules'
form is executed.  When the referenced module in turn references the
module that is currently being compiled, it can not use the partially
constructed compile-time represenation of the module-being-compiled.
The module is then loaded from source or an old compiled version is
used (if it isn't already present in the system anyway).

However, 'module-ref' forms can also refer to the
module-being-compiled by its real name in addition to the special name
'#t'.  That real name needs to be resolved to the compile-time
representation.

-- 
GPG: D5D4E405 - 2F9B BCCC 8527 692A 04E3  331E FAF8 226A D5D4 E405




reply via email to

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