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

From: Robby Findler (robby at eecs.northwestern.edu)
Date: Wed Oct 19 20:08:39 EDT 2011

On Wed, Oct 19, 2011 at 6:56 PM, Eli Barzilay <eli at barzilay.org> wrote:
> 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.)

This would be one way to solve it. Online check syntax would just save
up its IO (for the most recent run, anyways) and when you opened up
this new compile-time REPL, you'd see all that IO and the REPL would
be ready to go much more quickly than you might expect (since opening
the REPL will amount to just sending a message over to the other place
and asking for the IO (which would block if the expansion were still
pending)).

>> 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

Interesting thought. I have no idea how close that is to what you'd
really want, tho. Is it close?

Robby



Posted on the dev mailing list.