unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Vladimir Zhbanov <vzhbanov@gmail.com>
To: guile-user@gnu.org
Subject: Re: Using guile-scmutils with REPL and compilation
Date: Sat, 4 Jul 2020 17:57:37 +0300	[thread overview]
Message-ID: <20200704145737.GA2838@newvzh.lokolhoz> (raw)
In-Reply-To: <CAJN5JQqG-2U99Xt40RHamAncrJhkkv_KijS2=zrsOVQq0_6u4Q@mail.gmail.com>

On Sat, Jun 20, 2020 at 02:43:00AM +0300, Viacheslav Dushin wrote:
> Hello all
> 
> I have a couple of questions about guile-scmutils.
> 
> First one:
> I run into a similar problem that is described here:
> https://lists.gnu.org/archive/html/guile-user/2008-04/msg00007.html
> Turns out the solution is to modify top-repl as said here:
> https://lists.gnu.org/archive/html/guile-user/2008-04/msg00021.html
> 
> Since I'm new to Lisp I decided to work on the ice-9 source code
> directly. I'm going to create my own scmutils-top-repl after I resolve
> all problems.
> 
> Here is how my top-repl from top-repl.scm looks like:
> 
> (define (top-repl)
>   (let ((guile-user-module (resolve-module '(guile-user))))
> 
>     (add-to-load-path "/Users/slava/.guile.d/")
>     (load  (%search-load-path  "guile-scmutils/src/load.scm"))
>     (set-current-module generic-environment)
>     ;; Use some convenient modules (in reverse order)
> 
>     (set-current-module guile-user-module)
>     (process-use-modules
>      (append
>       '(((ice-9 r5rs))
>         ((ice-9 session)))
>       (if (provided? 'regex)
>           '(((ice-9 regex)))
>           '())
>       (if (provided? 'threads)
>           '(((ice-9 threads)))
>           '())))
> 
>     (call-with-sigint
>      (lambda ()
>        (and (defined? 'setlocale)
>             (catch 'system-error
>               (lambda ()
>                 (setlocale LC_ALL ""))
>               (lambda (key subr fmt args errno)
>                 (format (current-error-port)
>                         "warning: failed to install locale: ~a~%"
>                         (strerror (car errno))))))
> 
>        (let ((status (start-repl (current-language))))
>          (run-hook exit-hook)
>          status)))
>     )
>   )
> 
> I simply added these three lines:
>     (add-to-load-path "/Users/slava/.guile.d/")
>     (load  (%search-load-path  "guile-scmutils/src/load.scm"))
>     (set-current-module generic-environment)

The question is not about scmutils :-)

You can run Guile interactively, just type 'guile' in your
terminal, and check what every command returns. For example, the
following commands will give you your load path before and after
launching 'add-to-load-path':

scheme@(guile-user)> %load-path
scheme@(guile-user)> (add-to-load-path "/Users/slava/.guile.d/")
scheme@(guile-user)> %load-path

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

Make sure the file is found and is a string, not #f.  As I said
before (not sure you got it, sorry), 'load' will barf if its
argument is not a string.  It *will* barf if the argument is #f.
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"))

Another way is to just use:

scheme@(guile-user)> (primitive-load "/My/absolute/file/name.scm")

If you're defining a module in your file, use the 'use-modules'
procedure to load it.

Now about your second question.

I don't know, what 'generic-environment' is.  Is it defined at
all?  Try on the prompt:

scheme@(guile-user)> generic-environment

and read what it reports.

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.

HTH

-- 
  Vladimir

(λ)επτόν EDA — https://github.com/lepton-eda



  parent reply	other threads:[~2020-07-04 14:57 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-19 23:43 Using guile-scmutils with REPL and compilation Viacheslav Dushin
2020-06-20  7:33 ` Vladimir Zhbanov
2020-07-04 14:57 ` Vladimir Zhbanov [this message]
2020-07-08 21:04   ` Viacheslav Dushin
2020-07-09  6:32     ` Vladimir Zhbanov
  -- strict thread matches above, loose matches on Subject: below --
2020-06-20 14:39 Viacheslav Dushin
2020-07-04  1:06 Viacheslav Dushin
2020-07-04  4:15 ` Catonano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200704145737.GA2838@newvzh.lokolhoz \
    --to=vzhbanov@gmail.com \
    --cc=guile-user@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).