[r6rs-discuss] Interpreters need not apply?

David Van Horn dvanhorn at cs.brandeis.edu
Wed Mar 7 19:32:20 EST 2007


Aubrey Jaffer wrote:
>  | From: Pascal Costanza <pc at p-cos.net>
>  | Date: Wed, 7 Mar 2007 16:05:53 +0100
>  | 
>  | On 7 Mar 2007, at 15:51, AndrevanTonder wrote:
>  | 
>  | > On Wed, 7 Mar 2007, Pascal Costanza wrote:
>  | >
>  | >> The terms "compiler" and "interpreter" are not well-defined. But
>  | >> AFAICT, a compiler typically works in two phases: A translation
>  | >> from one representation to another one, where the latter is
>  | >> typically a representation that can be executed by some
>  | >> interpreter (for example, a CPU).
>  | >
>  | > No r5rs-conformant Scheme interpreter will start evaluating a
>  | > form without macro-expanding it first.  R6RS requires nothing
>  | > more than this.
>  | 
>  | Here is an example:
>  | 
>  | (if expression form1 form2)
>  | 
>  | Assume that both form1 and form2 are macro invocations.  Will form1
>  | and form2 both be macroexpanded before the if statement is
>  | evaluated, or will first the expression be evaluated and depending
>  | on its outcome only either form1 or form2 be expanded and then
>  | evaluated?
> 
> In SCM, only form1 or form2 will be expanded and evaluated.

Given this, the following behavior is curious to me:

    $ scm -r r5rs
    > (define-syntax go (syntax-rules () ((go) (go))))
    #<unspecified>
    > (if #t #t (go))
    #t
    > (lambda () (go))  ;; loops

 From my understanding of this discussion, this implies SCM is not a 
"pure interpreter", correct?

David




More information about the r6rs-discuss mailing list