Closed jpellegrini closed 1 year ago
Yes, it works:
$ stklos -dd
%guess-pathname: trying "/home/eg/.stklos/stklosrc"
;; Loading file "/home/eg/.stklos/stklosrc".
;; File "/home/eg/.stklos/stklosrc" loaded.
%guess-pathname: trying "/home/eg/Projects/STklos/lib/readline-complete.so"
;; Loading file "/home/eg/Projects/STklos/lib/readline-complete.so".
;; File "/home/eg/Projects/STklos/lib/readline-complete.so" loaded.
\ STklos version 1.70.1478 (unstable -- 195d9bfb)
\ Copyright (C) 1999-2023 Erick Gallesio <eg@stklos.net>
/ \ [Linux-6.1.49-1-MANJARO-x86_64/pthreads/readline/utf8]
/ \ Type ',h' for help
stklos> (require "scheme/flonum")
%guess-pathname: trying "scheme/flonum"
%guess-pathname: trying "scheme/flonum.so"
%guess-pathname: trying "scheme/flonum.ostk"
%guess-pathname: trying "scheme/flonum.stk"
%guess-pathname: trying "scheme/flonum.sld"
%guess-pathname: trying "scheme/flonum.scm"
%guess-pathname: trying "/home/eg/Projects/STklos/lib/scheme/flonum"
%guess-pathname: trying "/home/eg/Projects/STklos/lib/scheme/flonum.so"
%guess-pathname: trying "scheme/flonum"
%guess-pathname: trying "scheme/flonum.so"
%guess-pathname: trying "scheme/flonum.ostk"
%guess-pathname: trying "scheme/flonum.stk"
%guess-pathname: trying "scheme/flonum.sld"
%guess-pathname: trying "scheme/flonum.scm"
%guess-pathname: trying "/home/eg/Projects/STklos/lib/scheme/flonum"
%guess-pathname: trying "/home/eg/Projects/STklos/lib/scheme/flonum.so"
%guess-pathname: trying "scheme/flonum"
%guess-pathname: trying "scheme/flonum.so"
%guess-pathname: trying "scheme/flonum.ostk"
%guess-pathname: trying "scheme/flonum.stk"
%guess-pathname: trying "scheme/flonum.sld"
%guess-pathname: trying "scheme/flonum.scm"
%guess-pathname: trying "/home/eg/Projects/STklos/lib/scheme/flonum"
%guess-pathname: trying "/home/eg/Projects/STklos/lib/scheme/flonum.so"
%guess-pathname: trying "/home/eg/Projects/STklos/lib/scheme/flonum.so"
;; Loading file "/home/eg/Projects/STklos/lib/scheme/flonum.so".
;; File "/home/eg/Projects/STklos/lib/scheme/flonum.so" loaded.
"scheme/flonum"
As you can see, the file is found and loaded. However, require
is like load
(load if not already loaded). It is not aware of modules or libraries.
On the other hand, import
is a sort of "require before import" and then import.
If the file contains only one library/module, I think that importing is now a better solution than requiring IMO.
Ah, I see! I thought that importing would be automatic when one does (require x)
, wich x
being the name of a Scheme library.
Thanks a lot @egallesio !
If I use
require
, STklos says it's ok, but doesn't load the library:If I use
import
, it works:Or,