[racket-dev] displayln appears to write to console from where drracket was launched

From: Eli Barzilay (eli at barzilay.org)
Date: Wed Oct 19 19:56:44 EDT 2011

An hour and a half ago, Robby Findler wrote:
> On Wed, Oct 19, 2011 at 4:47 PM, Matthias Felleisen
> <matthias at ccs.neu.edu> wrote:
> >
> > On Oct 19, 2011, at 5:30 PM, Robby Findler wrote:
> >>
> >> I imagine it would work as by having an alternative to "run" that
> >> would just put you somehow into level 1.
> >
> > That's precisely what I imagine.
> >
> > Better still. It would be hidden all the time unless explicitly
> > opened.  You could then use it to perhaps inspect what live CS
> > really 'thinks.'

But this is very different from what the online check syntax is doing,
and the current problem of letting the output go to the console still
needs to be solved.  (And IMO, it should be discarded, still.)

> Yes, that seems doable, too. Probably we're missing something like
> "module->namespace" where you can specify a phase level. Or maybe
> there is a way to do it already(?).

You can fake it:

-> (define-syntax foo 123)
-> (begin-for-syntax (define bar 456))
-> foo
; stdin:3:0: foo: illegal use of syntax in: foo [,bt for context]
-> bar
; reference to undefined identifier: bar [,bt for context]
-> (define-syntax-rule (#%top-interaction . x) (begin-for-syntax x))
-> foo
; reference to undefined identifier: foo [,bt for context]
-> bar
-> (printf "bar = ~s\n" bar)
bar = 456

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

Posted on the dev mailing list.