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: Evaluator code question



> In eval.c, can anyone explain why scm_m_quote does a scm_copy_tree to
> copy the quoted expression, whereas scm_m_begin, scm_m_if etc. all
> just use the expression that they are given, without taking a copy?

The evaluator evaluates expressions in two steps:

1. compile code into a tree structure
2. evaluate this tree code.

While compiling a form like (display a) the evaluator takes every
symbol, asks the environment to look up and return its value
(`scm_lookupcar' returns a pointer to a vcell) and replaces the symbol
with the correct type code or a "memoized" vcell (gloc/iloc).

This must not happen with the sub-expression that "quote" protects.


Jost

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