This is the mail archive of the
guile@sourceware.cygnus.com
mailing list for the Guile project.
Re: Evaluator code question
- To: Neil Jerram <neil at ossau dot uklinux dot net>
- Subject: Re: Evaluator code question
- From: Jost Boekemeier <jostobfe at linux dot zrz dot TU-Berlin dot DE>
- Date: 10 Feb 2000 18:22:32 +0100
- Cc: guile at sourceware dot cygnus dot com
- References: <200002092206.WAA00471@ossau>
> 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