seanjensengrey / mosh-scheme

Automatically exported from code.google.com/p/mosh-scheme
Other
0 stars 0 forks source link

NMosh does not raise an error with included expression #240

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Prepare a file named "foo.scm"
(define ok 'ok)
(print ok)
(define ng 'ng)

2. Run following script;
#!r6rs
(import (for (rnrs) run expand))
(define-syntax include-it
  (lambda (x)
    (define (file->sexp-list file)
      (call-with-input-file file
        (lambda (in)
          (let loop ((e (read in)) (r '()))
            (if (eof-object? e)
                (reverse r)
                (loop (read in) (cons e r)))))))
    (syntax-case x ()
      ((k file)
       (string? (syntax->datum #'file))
       (let ((es (file->sexp-list (syntax->datum #'file))))
         (datum->syntax #'k `(begin ,@es)))))))
(define (print . args) (for-each display args) (newline))
(let ((a 'b))
  (include-it "foo.scm"))

What is the expected output? What do you see instead?
Error

ok is printed.

What version of the product are you using? On what operating system?
Cygwin 32
% nmosh -V
Mosh R6RS scheme interpreter, version 0.2.7 (mosh-0.2.7 Tue, 14 Jun 2011 
07:00:31 +0900)

Please provide any additional information below.

Original issue reported on code.google.com by ktakash...@gmail.com on 15 Aug 2014 at 7:09

GoogleCodeExporter commented 9 years ago
As i had explained elsewhere, it seems nmosh' cache problem. Nmosh caches 
compiled bytecode somewhere(~/.nmosh-cache on POSIX) and it won't track any 
side-effect during expansion.

In 0.2.7, you will have to specify --disable-acc to disable this cache.

0.2.8 will support R7RS define-library on nmosh expander and its (include ...) 
form would track source dependency properly -- unfortunately, it won't 
available as R6RS expand-time expression though; we take performance over macro 
flexibility here.

Sorry for the confusion, mark this entry as WONTFIX. 

Original comment by oku...@gmail.com on 29 Sep 2014 at 10:51