Comments (5)
If I run Racket in an Emacs *shell*
buffer, I got a similar but different issue:
$ racket
Welcome to Racket v5.93.
-> (require typed/racket)
(require typed/racket)
-> 1
1
- : Integer [more precisely: One]
1
->
It duplicates the 1
line instead of the type line.
Huh.
Looking through Typed Racket source code...
Note: The above is simply an Emacs comint-process-echoes
dealio. N/A
from racket-mode.
This seems to be an issue using racket/sandbox
and Typed Racket. IIUC Typed Racket's #%top-interaction
, although from looking at ti-core
so far I have no idea why.
#lang racket/base
(require racket/sandbox)
;; 1. Run this.
;; 2. In the resulting REPL, enter "1".
;; Result: The type information is printed twice:
;; - : Integer [more precisely: One]
;; - : Integer [more precisely: One]
;; 1
(call-with-trusted-sandbox-configuration
(lambda ()
(parameterize ([current-namespace (make-empty-namespace)]
[sandbox-input (current-input-port)]
[sandbox-output (current-output-port)]
[sandbox-error-output (current-error-port)])
(define e (make-evaluator 'typed/racket)) ;; [^note]
(parameterize ([current-eval e])
(read-eval-print-loop)))))
;; [note]: Same behavior instead using make-module-evaluator:
;; (define e (make-module-evaluator '(module m typed/racket 1)))
Either there will be some work-around (I'll ask on #racket IRC), or, I"ll have to rewrite this not to use racket/sandbox
.
(Even if it's considered a bug and they fix something in sandbox and/or TR?
That would likely not be in 6, much less in 5.3.6 or lolder version, which I hope to remain compatible with.)
from racket-mode.
...and, this seems to be an issue that racket/sandbox
has with any #%top-interaction
. Even just:
#lang racket
(provide (rename-out [-#%top-interaction #%top-interaction]))
(define-syntax (-#%top-interaction stx)
(syntax-case stx ()
[(_ . form)
#'(begin
(displayln "hi, mom!")
form)]))
So I'll look at some way of fixing or replacing racket/sandbox
...
from racket-mode.
So I finally tracked down what is happening. It's inside Racket's read-eval-print-loop
. See source.
If I replace all this business:
(let ([w (cons '#%top-interaction v)])
((current-eval) (if (syntax? v)
(namespace-syntax-introduce
(datum->syntax #f w v))
w))))))
with just this:
((current-eval) v)
all is fine.
But why this "fixes" it, I'm not sure.
- The business of
cons
-ing on the#%top-interaction
here seems unnecessary. Even without doing it, here, Typed Racket's#%top-interaction
is being used (somehow). - Since it's getting used, somehow/somewhere, apparently tacking it on here again is causing its
(display type)
side-effect to happen a second time here, which accounts for the double display?
from racket-mode.
Oh, OK. racket/sandbox
does this explicitly.
Assuming I understand that correctly, then a reasonable fix will be for me to use my alternative version of read-eval-print-loop
.
from racket-mode.
Related Issues (20)
- Using racket-hash-lang-mode with org-mode source blocks HOT 18
- `narrow-to-defun` doesn't work properly HOT 2
- `beginning-of-defun` doesn't work properly when narrowed HOT 6
- FYI: Scribble HTML change HOT 2
- `racket-xp-rename` could use future history
- support macro hiding in racket-stepper mode? HOT 10
- Racket mode is just not working. Can someone please help me? HOT 4
- Identifiers with @ in racket-xp-mode HOT 5
- Regexp-based highlighting of lines HOT 2
- racket-tests/expand-expression passes with racket 8.10 on debian HOT 1
- Length of popup error HOT 2
- Out of range error in narrowed buffer during redisplay using `racket-xp-mode` HOT 7
- REPL: only the first expression/form is evaluated/printed HOT 5
- racket-repl exec-path does not match racket-mode buffer's exec-path HOT 13
- Intermittent delays when inserting text when Racket-Mode is Enabled HOT 6
- view/run command history? HOT 2
- Bitmaps not render in the REPL with the HTDP HOT 5
- Install package from racket-mode? HOT 1
- Values are printed without newlines when `racket-pretty-print` is `nil` HOT 1
- `racket-hash-lang-mode`: Allow text tokens to use a different face
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from racket-mode.