1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-12 23:00:22 +02:00

eval is actually compile

* module/ice-9/boot-9.scm (eval): Here at the tail of boot-9, replace
  the root definition of `eval' with a procedure that will call
  `compile'.

* test-suite/tests/syntax.test ("top-level define"):
  ("internal define"): Run unmemoization tests in the interpreter, using
  primitive-eval.
This commit is contained in:
Andy Wingo 2009-08-20 14:33:38 +02:00
parent 2fb924f64f
commit afe5e6baa7
2 changed files with 30 additions and 24 deletions

View file

@ -3492,6 +3492,14 @@ module '(ice-9 q) '(make-q q-length))}."
;;; Replace the C evaluator with the compiler.
;;;
(define (eval x env)
((@ (system base compile) compile) x #:from 'scheme #:to 'value #:env env))
;;; Place the user in the guile-user module. ;;; Place the user in the guile-user module.
;;; ;;;

View file

@ -1,6 +1,6 @@
;;;; syntax.test --- test suite for Guile's syntactic forms -*- scheme -*- ;;;; syntax.test --- test suite for Guile's syntactic forms -*- scheme -*-
;;;; ;;;;
;;;; Copyright (C) 2001,2003,2004, 2005, 2006 Free Software Foundation, Inc. ;;;; Copyright (C) 2001,2003,2004, 2005, 2006, 2009 Free Software Foundation, Inc.
;;;; ;;;;
;;;; This library is free software; you can redistribute it and/or ;;;; This library is free software; you can redistribute it and/or
;;;; modify it under the terms of the GNU Lesser General Public ;;;; modify it under the terms of the GNU Lesser General Public
@ -807,20 +807,19 @@
(with-test-prefix "unmemoization" (with-test-prefix "unmemoization"
(pass-if "definition unmemoized without prior execution" (pass-if "definition unmemoized without prior execution"
(eval '(begin (primitive-eval '(begin
(define (blub) (cons ('(1 . 2)) 2)) (define (blub) (cons ('(1 . 2)) 2))
(equal? (equal?
(procedure-source blub) (procedure-source blub)
'(lambda () (cons ('(1 . 2)) 2)))) '(lambda () (cons ('(1 . 2)) 2))))))
(interaction-environment)))
(pass-if "definition with documentation unmemoized without prior execution" (pass-if "definition with documentation unmemoized without prior execution"
(eval '(begin (primitive-eval '(begin
(define (blub) "Comment" (cons ('(1 . 2)) 2)) (define (blub) "Comment" (cons ('(1 . 2)) 2))
(equal? (equal?
(procedure-source blub) (procedure-source blub)
'(lambda () "Comment" (cons ('(1 . 2)) 2)))) '(lambda () "Comment" (cons ('(1 . 2)) 2)))))))
(interaction-environment))))
(with-test-prefix "missing or extra expressions" (with-test-prefix "missing or extra expressions"
@ -896,16 +895,15 @@
(interaction-environment))) (interaction-environment)))
(pass-if "unmemoization" (pass-if "unmemoization"
(eval '(begin (primitive-eval '(begin
(define (foo) (define (foo)
(define (bar) (define (bar)
'ok) 'ok)
(bar)) (bar))
(foo) (foo)
(matches? (matches?
(procedure-source foo) (procedure-source foo)
(lambda () (letrec ((_ (lambda () (quote ok)))) (_))))) (lambda () (letrec ((_ (lambda () (quote ok)))) (_))))))))
(current-module))))
(with-test-prefix "set!" (with-test-prefix "set!"