This is the mail archive of the guile@sourceware.cygnus.com mailing list for the Guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Trouble understanding define (!)


Jost Boekemeier <jostobfe@linux.zrz.TU-Berlin.DE> writes:

> Marius Vollmer <mvo@zagadka.ping.de> writes:
> 
> > I think it is useful to sometimes clearly distinguish between
> > `compile-time' and `run-time' concepts.  Modules, macros, and
> > variables with their names are on the compile-time side
> 
> Definitely not.  Environments (and modules) are run-time concepts.
> Files, type definitions etc. (not variables!) are compile-time but
> that's a different thing.

Please also take the second paragraph into account.  The complete
passage is:

    I think it is useful to sometimes clearly distinguish between
    `compile-time' and `run-time' concepts.  Modules, macros, and
    variables with their names are on the compile-time side; classes,
    procedures and generic functions with their methods are on the
    run-time side.

    Of course, this distinction depends on the viewpoint, and the
    compile-time things should be reflected back into the run-time, so
    that there is run-time access to the compiler, the module system,
    etc, but one should be aware that one is now one level above the
    code one is compiling, or the objects that are given names by the
    module system.  Just like one needs to be aware of the differences
    between the code that computes macro expansions, and the code that
    they expand into.

For example, take the following piece of code

    (define (function a b)
      (let ((x (+ a b))
            (y (- a b)))
         (* x y)))

and think about what happens before it finally is executed.  The
current evaluator closely intertwingles compilation and execution but
for the sake of this discussion, let's pretend there are separate
passes for memoization (= compilation) and execution.

The compilation pass deals with the names in this code, namely `a',
`b', `x', `y' (and `function', `define', `let', `+', `-', `*', but
let's skip that for now).  After the function is memoized, there is no
reference to names any longer, there are just ilocs giving relative
offsets into the current lexical environment (and some glocs).  This
is what I am talking about in the first paragraph.  The memoization
pass also has to deal with the module system.

Of course, the memoizer is available at run-time, as the function
`eval', and the module system is, too.  But that's from a different
viewpoint.  That's what I'm talking about in the second paragraph.

- Marius

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]