racket / htdp

Other
93 stars 70 forks source link

Differences when running HtDP programs in DrRacket IDE versus racket command line #109

Closed yc2lee closed 1 year ago

yc2lee commented 4 years ago

There are some differences when HtDP programs are run from the DrRacket IDE versus using the "racket" command line program. I am using DrRacket 7.8 on MacOS 10.13.6.

For example, this Beginning Student code file:

;; The first three lines of this file were inserted by DrRacket. They record metadata
;; about the language level of this file in a form that our tools can easily process.
#reader(lib "htdp-beginner-reader.ss" "lang")((modname file) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f () #f)))

(exact? (string->number "1.0"))

will show #true when run in DrRacket IDE. But when run with racket file.rkt in the command line, it prints #false.

As another example, the following Beginning Student program shows an error "read-syntax: illegal use of ```" in DrRacket IDE:

;; The first three lines of this file were inserted by DrRacket. They record metadata
;; about the language level of this file in a form that our tools can easily process.
#reader(lib "htdp-beginner-reader.ss" "lang")((modname file) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f () #f)))
(define (quasiquote x) x)
(define (f x) 123)
`(f 888)

But when run with racket file.rkt in command line, prints 123.

There may be other differences, but these are just 2 examples I found.

Could the differences be fixed? My understanding is that the "racket" command line program should behave the same as clicking the "Run" button in DrRacket IDE.

Background discussion: https://groups.google.com/g/racket-users/c/r7ln_xUhJhY

mikesperber commented 1 year ago

This appears to be fixed.

(The recommendation is now to use #lang htdp/bsl instead of the menu-based teaching languages.)