IRC channel logs

2025-05-11.log

back to list of logs

<euouae>Hello can Guile be used for bootstrapping software?
<euouae>(and what does that mean exactly? is there some particular path by which we obtain a GNU Guile compiler?)
<euouae>Hmm... the docs of GNU mes explain this
<mccd>I have a weird issue when I try to pipe a message using socat to a guile repl. So I have a guile repl running on $SOCKET:
<mccd>$ export MSG="(define bemenu-run-app
<mccd>  (with-imported-modules '((lisp-machine bemenu))
<mccd>    #~(begin
<mccd>        (use-modules (lisp-machine bemenu))
<mccd>        (bemenu-run))))"
<mccd>$ printf '(use-modules (guix gexp))\n' "$MSG" | socat - UNIX-CLIENT:$SOCKET
<mccd>I get the error socket:12:7: Unknown # object: "#~"
<mccd>If I type these commands directly into the repl, I don't get this error.
<mccd>Sorry the command is
<mccd>$ printf '(use-modules (guix gexp))\n%s' "$MSG" | socat - UNIX-CLIENT:$SOCKET
<mccd>Seems to be something with the read syntax? This fails as well:
<mccd>guile -c '#~(display "hi")'
<mccd>ice-9/read.scm:126:4: In procedure read-expr*:
<mccd>#<unknown port>:1:3: Unknown # object: "#~"
<sham1>I think you might have to import (guix gexp)
<sham1>Which you are, reading the messages more carefully
<mccd>sham1, yeah I solved it by adding it to the repl code... but I am suprised I couldn't load the module directly from the rpl
<sham1>It might be that for whatever reason it's not able to redefine the read procedure properly. https://codeberg.org/guix/guix-mirror/src/branch/master/guix/gexp.scm#L2280
<sham1>I don't see why not, but yeah
<identity>Guile seems to implement 'exit' by raising an exception, which seems to be clearly in conflict with R7RS-small's description of exit: "The 'exit' procedure must not signal an exception..."
<mccd>Is there a way to print an error to a string?
<identity>mccd: check out 'open-output-string'
<mccd>identity that works, but how do I actually display the exception object? I think I need to use `display-error` but I'm not sure where the arguments come from
<mccd>like frame args rest
<mccd>This is the function I'm working with
<mccd>(define (load-fifo-file file-name)
<mccd>  (catch #t
<mccd>    (lambda ()
<mccd>      (primitive-load file-name))
<mccd>    (lambda (exn)
<mccd>      (match (exception-kind exn)
<mccd>        ('quit  ; (exit) or (quit) is written to the FIFO file
<mccd>         (exit))
<mccd>        ('system-error
<mccd>         (display "Something wrong with the FIFO file:")
<mccd>         (exit 1))
<mccd>        (_
<mccd>          (echo-debug "printing error")
<mccd>          (let ((msg (call-with-output-string
<mccd>                                     (lambda (p)
<mccd>                                       (apply display-error #f p exn)))))
<mccd>            (echo-debug msg)))))))
<identity>mccd: if you just need to display the exception's &message then you could (display (exception-message exception) port)
<identity>also you probably want to paste that to a pastebin instead of pasting directly into the chat
<mccd>Thanks, sorry I'll paste in a pastebin in the future