[racket-dev] REPL crash

From: Eli Barzilay (eli at barzilay.org)
Date: Tue Nov 30 23:14:42 EST 2010

5 hours ago, Dmitry Chestnykh wrote:
> The following example from docs (11.9) crashes console REPL (but not
> gracket or DrRacket):
> 
>   (define-namespace-anchor anchor)
>   (parameterize ([current-namespace
>                   (namespace-anchor->namespace anchor)])
>    (expand
>     (datum->syntax
>      #f
>      '(delay (+ 1 2)))))

Namespace anchors are intended to be used from modules, when you're in
the REPL you don't really need to use them -- since you already have
the `current-namespace'.

The bug is still a bug, of course, just happens to be code that nobody
would try...  Here's a shorter version:

   (define-namespace-anchor anchor)
   (eval 1 (namespace-anchor->namespace anchor))

and in more primitive terms:

  (define tmp #f)
  (define r (#%variable-reference tmp))
  (eval 1 (variable-reference->namespace r))

-- 
          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                    http://barzilay.org/                   Maze is Life!


Posted on the dev mailing list.