[plt-scheme] Why this crash DrScheme ?

From: Jaime Vargas (jev at mac.com)
Date: Tue Jun 20 23:53:49 EDT 2006

I was just playing with macros trying to emulate other languages  
grammar, and I manage to crash DrScheme v350 consistently.  Here is  
the code:

(define-syntax loop
   (syntax-rules ()
     ((loop n expr1 expr2 ...)
      (let iterate ([i 0])
        (set! i (add1 i))
        (if (<= i n)
            (begin
              expr1 expr2 ...
              (iterate i)))))))

(define-syntax ++
   (syntax-rules ()
     ((++ val) (begin
                 (set! val (+ val 1))
                 val))))

(define i 0)
(loop 10
       (printf "~a~n" (++ val)))

I know the error is that val is not defined, however DrScheme doesn't  
signal this instead it tries to execute and then it crashes. Should  
this behavior happen?

-- Jaime

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20060620/6de65028/attachment.html>

Posted on the users mailing list.