On Thu, Jul 09, 2020 at 12:04:29AM +0300, Viacheslav Dushin wrote: ...
> >Another way is to just use: > > >scheme@(guile-user)> (primitive-load "/My/absolute/file/name.scm") > > What's the key difference between load and primitive-load? The docs are > unclear. AFAICS in the docs, under the hood, 'load' calls for 'primitive-load', it's a wrapper for it and may take an additional argument, the "reader" procedure. It's a subject to play with :-) ... > Anyway thanks for your answer. I moved a bit forward with this code > > (add-to-load-path "/Users/slava/.guile.d/") > (load (%search-load-path "guile-scmutils/src/load.scm")) > (use-modules (generic-environment)) > > Now it fails with the following error: > > ;;; note: source file > /Users/slava/Documents/work/func-diff-geometry/prologue/code.scm > ;;; newer than compiled > /Users/slava/.cache/guile/ccache/3.0-LE-8-4.3/Users/slava/Documents/work/func-diff-geometry/prologue/code.scm.go > ;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=0 > ;;; or pass the --no-auto-compile argument to disable. > ;;; compiling > /Users/slava/Documents/work/func-diff-geometry/prologue/code.scm > ;;; WARNING: compilation of > /Users/slava/Documents/work/func-diff-geometry/prologue/code.scm failed: > ;;; no code for module (generic-environment) Is there the file "generic-environment.scm" with the module definition "(define-module (generic-environment) ...)" in the '%load-path' visible within 'code.scm'? ... > I think the main question is why REPL and compiler act differently. > This code works ok inside the REPL but fails to compile: > (add-to-load-path "/Users/slava/.guile.d/") > (load (%search-load-path "guile-scmutils/src/load.scm")) > > (set-current-module generic-environment) > > (define ((Gamma w) t) > (up t (w t) ((D w) t))) Maybe, different settings wrt '%load-path' and such in some config files? Or maybe some additional modules are loaded when the REPL starts? Check what '%load-path' and '(module-uses (current-module))' return in both cases. (Dunno, if '%load-compiled-path' can affect something in such a case.) HTH -- Vladimir (λ)επτόν EDA — https://github.com/lepton-eda