[racket-dev] , en and enter! sometimes do nothing, and it's changing over releases?

From: Greg Hendershott (greghendershott at gmail.com)
Date: Mon Feb 11 11:17:28 EST 2013

Well first let me back up and provide a simple recipe for the first
issue -- `,enter` not behaving like `enter!` with respect to reloading
changed files. IIRC this started to happen circa 5.3.1.

First let's try `enter!`:

    $ /Applications/Racket_v5.3.1/bin/racket
    Welcome to Racket v5.3.1.
    -> ,cd /tmp
    ; now in /tmp
    -> ,sh
    echo '#lang racket' > x.rkt
    echo '"hi"' >> x.rkt
    exit
    (require racket/enter)
    -> (enter! "x.rkt")
    "hi"
    "x.rkt"> (enter! "x.rkt")  ;does nothing. OK fine.
    "x.rkt"> ,sh
    echo '"there"' >> x.rkt
    exit
    (enter! "x.rkt")           ;re-loads changed file. Yay!
      [re-loading /tmp/x.rkt]
    "hi"
    "there"
    "x.rkt"> (exit)

Notice that after x.rkt is changed, `enter!` _does_ re-load and
re-evaluate the file and display "hi\nthere".

But next let's try using `,enter`:

    $ /Applications/Racket_v5.3.1/bin/racket
    Welcome to Racket v5.3.1.
    -> ,cd /tmp
    ; now in /tmp
    -> ,sh
    echo '#lang racket' > x.rkt
    echo '"hi"' >> x.rkt
    exit
    ,enter x.rkt
    "hi"
    "x.rkt"> ,enter x.rkt     ;does nothing. OK fine.
    "x.rkt"> ,sh
    echo '"there"' >> x.rkt
    exit
    ,enter x.rkt              ;still does nothing. Boo!
    "x.rkt"> (exit)

Notice that after x.rkt is changed, `,enter` does _not_ re-load and
re-evaluate th fiel and display "hi\nthere". Why not? Shouldn't it?

That's one issue. At the time I noticed it was I in the middle of
something, stuck with `enter!`, and didn't worry about it.


Second issue is sometimes `enter!` doesn't reload, either. I've
noticed this more recently. Although I have a reliable recipe (the
#lang rackjure one above), I haven't yet boiled this down to the
simplest-possible recipe. Unless it's already obvious to you what's
going on with that, I'll keep working to come up with a simpler
recipe.

Thank you.

On Mon, Feb 11, 2013 at 2:07 AM, Eli Barzilay <eli at barzilay.org> wrote:
> 9 hours ago, Greg Hendershott wrote:
>> I'm inclined to add a new command to XREPL that takes that approach,
>> to experiment. I was spelunking in DrRacket source but I'm slow to
>> isolate that from what else is going on. It sounds like you
>> understand it; is there a code sample you could share?
>
> I'm not sure what exactly you're after, but you can get most of that
> using a ,switch command to create a new namespace, then using it with
> a "!" flag to reset it.
>
> --
>           ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
>                     http://barzilay.org/                   Maze is Life!

Posted on the dev mailing list.