Compiling REPL pasted by cipherchess on Thu May 6 17:51:34 2021

;; cat test.scm 
(use linenoise)
(import scheme linenoise something)

(set-history-length! 300)
(load-history-from-file ".linenoise-history")
(current-input-port (make-linenoise-port))
(repl)


;; cat something.import.scm 
(module something *
  (import scheme)
  (define (hello)
    (display "Hello world"))
)

;; csc test.scm -I something.import.scm && ./test

;; The repl has the linenoise features I was looking for,
;; but it doesn't load the context where I import
;; the definitions in the module ``something''.

;; Typing (hello) results in an ``unbound variable'' error.

C5 version pasted by wasamasa on Thu May 6 18:34:06 2021

;; cat test.scm 
(import scheme)
(import (chicken base))
(import (chicken repl))
(import linenoise)
(import something)

(set-history-length! 300)
(load-history-from-file ".linenoise-history")
(current-input-port (make-linenoise-port))
(repl)

;; cat something.import.scm 
(module something *
  (import scheme)
  (define (hello)
    (display "Hello world"))
)

;; csc -shared -J something.scm
;; csc test.scm && ./test

#;> (hello)

Error: unbound variable: hello

        Call history:

        <syntax>          (##core#begin (##core#require library scheme#) (##core#require library chicken.base#) (##core#requir...
        <syntax>          (##core#require library scheme#)
        <syntax>          (##sys#load-library (##core#quote library))
        <syntax>          (##core#quote library)
        <syntax>          (##core#require library chicken.base#)
        <syntax>          (##sys#load-library (##core#quote library))
        <syntax>          (##core#quote library)
        <syntax>          (##core#begin (##core#require expand chicken.syntax#))
        <syntax>          (##core#require expand chicken.syntax#)
        <syntax>          (##sys#load-library (##core#quote expand))
        <syntax>          (##core#quote expand)
        <eval>    (##sys#load-library (##core#quote library))
        <eval>    (##sys#load-library (##core#quote library))
        <eval>    (##sys#load-library (##core#quote expand))
        <syntax>          (hello)
        <eval>    (hello)       <--
#;> #;> (import something)
; loading ./something.import.scm ...
#;> #;> (hello)
Hello world#;> #;> 

C5 version, fixed added by wasamasa on Thu May 6 18:39:33 2021

;; cat test.scm
(import scheme)
(import (chicken base))
(import (chicken repl))
(import linenoise)
(eval '(import something))

(set-history-length! 300)
(load-history-from-file ".linenoise-history")
(current-input-port (make-linenoise-port))
(repl)

;; cat something.scm 
(module something *
  (import scheme)
  (define (hello)
    (display "Hello world"))
)

;; csc -shared -J something.scm
;; csc test.scm && ./test

#;> #;> (hello)
Hello world#;> #;>