<div dir="ltr">So apropos to <a href="http://blog.racket-lang.org/2009/03/drscheme-repl-isnt-lisp.html">http://blog.racket-lang.org/2009/03/drscheme-repl-isnt-lisp.html</a> one "fix" to the enter! bug is to keep it as simple as possible and as Robby hinted, fresh load the module into a new namespace on every enter.<div>
<br></div><div>I've done some minimal testing and so far things appear to work.<br><div><br></div><div style>Advantage:</div><div style> - No custom loader which attempts to minimize module reloading as currently being done in enter.rkt. Instead use the existing CM logic within the Racket's default behavior.</div>
<div style> - enter.rkt is stable over internal changes as no tricks are being played to "smart" incremental load.</div><div style> - Reloading Typed Racket modules now works by a simple require/typed on do-enter!.</div>
<div style> - Emulates DrRacket behavior.</div><div style><br></div><div style>Disadvantage, when (re)entering a module, it is from scratch, hence, slower. But I've been re-entering slightly modified TR module in some of my personal code that has a pretty healthy typed-racket module dependency graph and with Racket's default CM behavior it's about a 3 sec load. </div>
</div><div style><br></div><div style>The only issue with this approach is on support for re-entering/entering a different module. Currently 'enter!' loads the module and then extends/injects into the namespace racket/enter. Obviously this it to allow one to enter! another module from within the currently entered module. In plain ol' Racket no problem.</div>
<div style><br></div><div style>However if the module I'm entering is a typed/racket module then the injected do-enter! method is untyped and fails when trying to (re)enter another module. By creating simple typed-enter.rkt which require/typed do-enter! and then exports it everything works.</div>
<div style><br></div><div style>So the goal is to have entering a module inject the proper typed or untyped version of do-enter! by doing a namespace-require on either "enter.rkt" or "typed-enter.rkt". To do that I need to query the current-namespace as to whether the namespace language is racket or typed/racket, a "namespace-language" procedure. </div>
<div style><br></div><div style>How do I do that?</div><div style><br></div><div style><br></div><div style>Thanks,</div><div style><br></div><div style>Ray</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">
On Thu, Feb 7, 2013 at 9:15 AM, Greg Hendershott <span dir="ltr"><<a href="mailto:greghendershott@gmail.com" target="_blank">greghendershott@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Once upon a time, ~5.3, the XREPL ,en command would always reload a<br>
file provided the timestamp changed.<br>
<br>
As a result, I could do something _roughly_ like DrRacket F5 in Emacs:<br>
Touch the file and ,en it. The whole file would be evaluated, and I'd<br>
have a REPL where I could explore/tweak.<br>
<br>
But somewhere around ~5.3.1, ,en stopped doing this reliably.<br>
Sometimes it would just do nothing, even if the file timestamp had<br>
changed (and even if I made some change to the contents, just in case<br>
it was doing a checksum or whatever).<br>
<br>
I thought to try using enter!. And that worked consistently.<br>
<br>
But somewhere around ~5.3.2, enter! has stopped behaving consistently.<br>
<br>
Does anyone have any idea would could be going on??<br>
<br>
More info/comments:<br>
<br>
- I normally use XREPL. (require xrepl) is the _only_ thing in my racketrc.<br>
<br>
- The above issue happens with or without XREPL. (I tried again today<br>
to confirm.)<br>
<br>
- Although I love the idea of Geiser, I've had it also sometimes not<br>
reevaluate (similar issue). Anyway sometimes I just want to strip<br>
things down to be simpler; lately I'm in such a phase where I haven't<br>
been using it. I might or could use it again someday.<br>
<br>
- A (related?) issue is that sometimes the first invocation of enter!<br>
gives an error like this:<br>
<br>
> (enter! "client.rkt")<br>
module->namespace: module not instantiated in the current namespace<br>
name: #<resolved-module-path:"/Users/greg/src/scheme/collects/lob/example/client.rkt"><br>
context...:<br>
/Users/greg/src/plt/racket/collects/racket/enter.rkt:33:0: do-enter!<br>
/Users/greg/src/plt/racket/collects/racket/private/misc.rkt:87:7<br>
<br>
But then a second invocation works fine. i.e. Need to do it twice in a row.<br>
_________________________<br>
Racket Developers list:<br>
<a href="http://lists.racket-lang.org/dev" target="_blank">http://lists.racket-lang.org/dev</a><br>
</blockquote></div><br></div>