guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using guile-scmutils with REPL and compilation


From: Viacheslav Dushin
Subject: Re: Using guile-scmutils with REPL and compilation
Date: Thu, 9 Jul 2020 00:04:29 +0300

Hello, sorry for the late reply.

zhbanov@gmail.com


I already have "/Users/slava/.guile.d/" in the load path
>scheme@(guile-user)> %load-path
Here is the output:
$1 = ("/Users/slava/.guile.d/"
"/usr/local/Cellar/guile/2.2.7_2/share/guile/2.2"
"/usr/local/Cellar/guile/2.2.7_2/share/guile/site/2.2"
"/usr/local/Cellar/guile/2.2.7_2/share/guile/site"
"/usr/local/Cellar/guile/2.2.7_2/share/guile")

>Check, if the directory *really* contains your file
>"guile-scmutils/src/load.scm", and try the following after that:

>scheme@(guile-user)> (%search-load-path  "guile-scmutils/src/load.scm")
yes, I checked, the file is there:
 (%search-load-path  "guile-scmutils/src/load.scm")
$1 = "/Users/slava/.guile.d/guile-scmutils/src/load.scm"


>So, only if the command above returns the file name you're
>searching for, try loading it:

>scheme@(guile-user)> (load  (%search-load-path
 "guile-scmutils/src/load.scm"))
yes, it works, the output:
(load  (%search-load-path  "guile-scmutils/src/load.scm"))
$2 = done

>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.

There is a strange thing: compilator was able to find
"guile-scmutils/src/load.scm"
only when I added "/Users/slava/.guile.d/" at the beginning of my code.
In interactive mode this line is not needed: `.guile` file is loaded.

>If you're defining a module in your file, use the 'use-modules'
>procedure to load it.
Ok, I'll post the updated code later

Now about your second question.

>I don't know, what 'generic-environment' is.  Is it defined at
>all?
Yes, in guile-scmutils/src/kernel/genenv-module.scm

>Try on the prompt:

>scheme@(guile-user)> generic-environment

>and read what it reports.
yes, the output is:
$2 = #<module (#{ g3541}#) 110a1a8c0>

>BTW, the command '(set-current-module generic-environment)' won't
>work anyway in your code, since you use '(set-current-module
>guile-user-module)' just *after* it.
my bad.


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)


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)))

I'll keep looking into the scmutils code right now.

Thanks, Slava


>
>
>


reply via email to

[Prev in Thread] Current Thread [Next in Thread]