Skip to content

Commit

Permalink
Avoid exporting REPL variables from #<module gauche>
Browse files Browse the repository at this point in the history
  • Loading branch information
shirok committed Oct 6, 2024
1 parent b9ca000 commit 2fec7e8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
6 changes: 6 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
2024-10-05 Shiro Kawai <[email protected]>

* lib/gauche/interactive.scm: Avoid exporting REPL-variables *1 etc.
from #<module gauche>.
https://github.com/shirok/Gauche/issues/1066

2024-10-03 Shiro Kawai <[email protected]>

* ext/digest/sha3.c: Officially support SHA-3. Add SHA3-224.
Expand Down
11 changes: 7 additions & 4 deletions lib/gauche/interactive.scm
Original file line number Diff line number Diff line change
Expand Up @@ -259,8 +259,11 @@
;; modules in REPL without losing access to the history. So we "inject"
;; those variables into #<module gauche>. It is not generally recommended
;; way, though.
;; We also export those history variables, so the modules that does not
;; inherit gauche can still use them by (import gauche :only (*1 ...)).
;;
;; We also export those history variables from gauche.base, if it has already
;; been loaded. Moduels that imports gauche.base should see all variables
;; defined in #<module gauche>. This runtime hack is also a kludge.

(define-in-module gauche *1 #f)
(define-in-module gauche *1+ '())
(define-in-module gauche *2 #f)
Expand All @@ -273,8 +276,8 @@
(display "*2: ") (repl-print *2) (newline)
(display "*3: ") (repl-print *3) (newline)
(values))
(with-module gauche
(export *1 *1+ *2 *2+ *3 *3+ *e *history))
(and-let1 m (find-module 'gauche.base)
(eval '(export *1 *1+ *2 *2+ *3 *3+ *e *history) m))

(define (%set-history-expr! r)
(unless (null? r)
Expand Down

0 comments on commit 2fec7e8

Please sign in to comment.