heap/literal fixes for repl-default-options
authorAndy Wingo <wingo@pobox.com>
Sat, 10 Jul 2010 08:49:01 +0000 (10:49 +0200)
committerAndy Wingo <wingo@pobox.com>
Sat, 10 Jul 2010 08:49:01 +0000 (10:49 +0200)
* module/system/repl/common.scm (repl-default-options): Heap-allocate
  the repl-default-options, to avoid mutating a literal.
  (make-repl): Copy repl-default-options.

module/system/repl/common.scm

index 9d71e99..0c42ea7 100644 (file)
@@ -104,14 +104,15 @@ See <http://www.gnu.org/licenses/lgpl.html>, for more details.")
   language options tm-stats gc-stats inport outport debug)
 
 (define repl-default-options
-  '((compile-options . (#:warnings (unbound-variable arity-mismatch)))
-    (trace . #f)
-    (interp . #f)))
+  (copy-tree
+   '((compile-options . (#:warnings (unbound-variable arity-mismatch)))
+     (trace . #f)
+     (interp . #f))))
 
 (define %make-repl make-repl)
 (define* (make-repl lang #:optional debug)
   (%make-repl #:language (lookup-language lang)
-              #:options repl-default-options
+              #:options (copy-tree repl-default-options)
               #:tm-stats (times)
               #:gc-stats (gc-stats)
               #:inport (current-input-port)