guile-devel
[Top][All Lists]
Advanced

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

Re: What's the status of modules and macros?


From: Rob Browning
Subject: Re: What's the status of modules and macros?
Date: 13 May 2001 11:15:35 -0500
User-agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7

Marius Vollmer <address@hidden> writes:

> Syntax-case works by renaming all lexical variables in a special way
> so that unwanted name-clashes are avoided.  I want to extend this
> rewriting so that references to top-level variables are `annotated'
> with the module that they are to be found in.  This could be done
> with a new special form that is memoized into a gloc.

So I presume there's a way to ask a reference if it's "top-level".
(I'll go look a the syntax-case code...)

Also, I looked up gloc and found it in
devel/modules/module-snippets.texi.  From that definition I gather
that it's just a way you can directly access a variable i.e. if a
variable value was in the cdr of a cons cell, a gloc might just be the
cons cell.  Is that right?

> More specifically, without having really thought it thru, the `syntax'
> special form will make this annotation by replacing all references to
> free variables with something like `(:module-ref VAR MOD)' where VAR
> is the symbol that denotes the variable and MOD is the name of the
> module that is to be used to do the lookup (or the module itself, not
> sure yet).  The memoizer will specially recognize the :module-ref
> keyword and turn it into a gloc (using the observer mechanism to
> perform re-lookups when the symbol/variable mapping in MOD changes).

In general terms, that makes perfect sene to me, though I'm not
familiar enough with what happens where to be able to try to implement
it myself yet :>

So does this replacement (of a reference with a gloc) happen at
run-time (the first time it's hit) or at macro-expansion time (I
figure the latter, but just want to make sure I'm developing a decent
mental model of the process).

> If this is used exclusively, all references to top-level bindings
> are explicit, and we wouldn't need to store the lookup closure at
> the bottom of the lexical environment.

Which directon is "up" here?  Is the top-level environment at the
bottom of the "lookup chain"?  (Just trying to make sure I'm
understanding right).

> The downside to this fix is that it works only with syntax-case, which
> is still only an optional feature of Guile.  Defmacros could use it as
> well, but only manually and non-portably, which might well be
> acceptable.

Hmm.  It would be nice if we could figure out a strategy that works
for macros transparently (without having to re-write any that refer to
module local bits), but I don't have any suggestions right now :>

Thanks

-- 
Rob Browning <address@hidden> PGP=E80E0D04F521A094 532B97F5D64E3930



reply via email to

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