IRC channel logs

2020-07-24.log

back to list of logs

<daviid>str1ngs: ok, great, hope it helps seeple, let's see
<daviid>str1ngs: it's a beautiful module def you ge there, which even gi-import "Nomad" itself
<daviid>:), impressive (I know it relates to the part you wrote in C and made those GI, really impressive to ...
<daviid>str1ngs: any particular reason you use map, as opposed to for-each i mean, in the eval-when expr? just curious
<daviid>str1ngs: wrt to this 'order' you mention i the explanation, do you mean if you import the Gtk 'stuff' before the Gdk 'stuff' it woud, it would fail on guix?
<daviid>str1ngs: also, you seem to say there are more then one gir-1.2-* lib installed on guix, so there would be more then one gir1.2-gdkpixbuf-2.0 ?
<daviid>str1ngs: excuse my ignorance - just trying to understand and the reason is this:
<daviid>str1ngs: do you think we should add a note in g-golf manual about this? iirc, and can count :), this is now the third user who is unable to simply install the the g-golf guix package and use it ...
***jonsger1 is now known as jonsger
<daviid>*we/I should add - but I'd need help to write it ...
***catonano_ is now known as catonano
<minerjoe>Does anyone here know a good library for running shell commands? I need some way to execute a bash script from within guile and get access to the stdout and stderr. I've been playing with the new pipeopen but having trouble getting stderr.
<str1ngs>sneek: later tell daviid. Thanks for look at (nomad gtk gi) module. no particular reason I'm using map other then to experiment with it more. for-each is more natural for me since it's procedural so I'm trying to use map more. the Nomad typelib is now down to only 7 functions and is left over from porting from C. It's actually nice to have since it can be used instead of SCM_DEFINE and function methods are automatically exposed to
<str1ngs>scheme thanks to g-golf and GI. The guix problem is a little harder to document for right now the most I have gleamed on the issue is gi-import can be order dependent on guix. It's possible this patch used by guix could be improved http://git.savannah.gnu.org/cgit/guix.git/tree/gnu/packages/patches/gobject-introspection-absolute-shlib-path.patch or just due to the nature of guix gi-imports will always be order dependant.
<sneek>Got it.
<ArneBab>minerjoe: I’m unsure about stderr; what I use is (use-modules (ice-9 popen))
<dsmith>minerjoe: Pretty sure the current pipe stuff doesn't mess with stderr. Just look at ice-9/popen.scm
<ArneBab>-> open-pipe
<str1ngs>sneek: later tell daviid. I need to test g-golf using guix system soon. I might be able to grasp the issue better and find any other guix related problems I think there could be another issue. I mainly use a debian workflow with autotools and periodically I'll test guix but with my foreign distro install.
<sneek>Got it.
<ArneBab>I would have expected this to control output and error port, but I don’t get the string from the error port: (import (ice-9 rdelim))(import (ice-9 popen))(let* ((err (open-output-string))(port (with-error-to-port err (λ()(open-input-pipe "echo 1; echo 2 >&2"))))) (list (flush-all-ports) (read-delimited "" port) (get-output-string err)))
<ArneBab>Do I misunderstand something or is this a bug?
<RhodiumToad>as far as I know, with-error-to-port only affects scheme code in the current dynamic context, it doesn't do an OS-level redirection
<nios34>Hello. I want to translate the GNU Guile Manual. So, where are the sources of that? And, how to build that?
***jonsger1 is now known as jonsger
<heisenberg-25>I have the following issue. When I call (dynamic-link "liba") from the guile repl it works. But if I add this to a scm file and try to compile that scm file with autotools I get dynamic-link: file: "liba", message: "file not found" error. Has anyone had similar issue? It's kinda annoying
<str1ngs>heisenberg-25: does using (dynamic-link "/full/path/to/liba.so") help?
<str1ngs>heisenberg-25: also which OS distro are you using?
<heisenberg-25>str1ngs: using the full path still fails. I am using Mac OS
<ArneBab>RhodiumToad: do you know how to change the error-port of open-pipe?
<str1ngs>ahh on MacOS it's probably liba.dynlib
<str1ngs>IIRC
<ArneBab>I’ve also been searching for that multiple times, but I don’t think I found a solution.
<str1ngs>heisenberg-25: is LD_LIBRARY_PATH set at all?
<heisenberg-25>yeah, but setting the lib extension doesn't fix it
<str1ngs>where is liba.dynlib btw/
<str1ngs>guile will search known library paths and add the right extension so it should work. when using guile repl and dynamic-lib is the library useable?
<heisenberg-25>LD_LIBRARY_PATH is set and includes the directory where the lib resides.
<heisenberg-25>the odd thing is it works from guile repl and also compiles for other libraries in the same dir. it just for a particular library it is refusing to link
<str1ngs>from the guile REPL does (getenv "LD_LIBRARY_PATH") output the path as well?
<str1ngs>the only thing I can think is when building with autotools (getenv "LD_LIBRARY_PATH") is not set. maybe have the module/file print that first see if it differs when you are building
<mwette>maybe LD_LIBRARY_PATH=/path/to/dir guild compile mylib.scm
<mwette>ls
<str1ngs>- irc: ls: command not found :P
<mwette>:P
<heisenberg-25>str1ngs: You are right. (getenv "LD_LIBRARY_PATH") returns the correct value from the guile repl. but empty when I try to display from the file
<minerjoe>ArneBab: Yea, I know about popen, but it doesn't give me a pipe to stderr. It looks like above you were attempting? Any luck?
<minerjoe>You'd think there has to be a way in guile to do something like (system "foo") and get the output of stdout and stderr?
<RhodiumToad>ArneBab: ok so I was slightly wrong
<RhodiumToad>ArneBab: open-pipe _is_ supposed to inherit current-error-port, but _only_ if it is a port that has a file descriptor, which string ports don't.
<dsmith-work>Happy Friday, Guilers!!
<dsmith-work>nios34: In the doc/ref dir in the guile sources
<minerjoe>RhodiumToad: I'm attempting to port shellpool http://github.com/jaredcdavis/shellpool from common lisp to guile and hit the snag that in CL when I open a subprocess I get two output streams, one for stdout and one for stderr. That library uses that to perform a small bit of magic. With guile, the stderr part seems to have been conspiculously left out. Is there a reason for this and is there a way to do that?
<mwette>maybe guile needs a pipe-cleaner
<dsmith-work>Maybe some combination of with-error-to-port and pipe to make a pipe for stderr, wrapped around the "normal" subprocess piping..
<dsmith-work>minerjoe: How does CL handle having pipes from both stdout and stderr without deadlocking? As in you are blocked reading from the stdout pipe and the subprocess is blocked writing to it's stderr.
<dsmith-work>Or maybe that can't happen?
<ArneBab>RhodiumToad: is there a way to create a port with a fake filedescriptor?
<RhodiumToad>fake?
<RhodiumToad>you'd have to create a pipe and handle reading from it safely yourself
<RhodiumToad>and as pointed out already, deadlock is a huge problem
<dsmith-work>Yeah. I wonder how CL handles that.
<ArneBab>RhodiumToad: could I make a read-write pipe and only read from it after the other pipe is closed?
<RhodiumToad>that risks exactly the deadlock problem
<RhodiumToad>if the child process fills that pipe buffer then it will block
<RhodiumToad>resulting in it never closing the stdout pipe
<ArneBab>then you’ll need a thread that reads?
<RhodiumToad>or to do all your reading in a nonblocking or multiplexed fashion
<ArneBab>how can I do that?
<ArneBab>I’m asking, because that is a very common usecase
<RhodiumToad>looking at the guile docs, it does support all the low-level operations you'd need to be able to do this in guile, I think
<RhodiumToad>see "ports and file descriptors" in the docs
<RhodiumToad>oh, for another approach see the "suspendable-ports" module
<RhodiumToad>see under "Nonblocking I/O" in "Input and Output"
<ArneBab>RhodiumToad: got it working without nonblocking for now: (import (ice-9 rdelim) (ice-9 popen) (rnrs io ports))(let* ((err-cons (pipe))(port (with-error-to-port (cdr err-cons) (λ()(open-input-pipe "echo 1; echo 2 >&2"))))) (list (flush-all-ports) (read-delimited "" port) (close-port (cdr err-cons)) (read-delimited "" (car err-cons))))
<ArneBab>minerjoe: see above
<ArneBab>it still works after (import (ice-9 suspendable-ports))(install-suspendable-ports!)
<ArneBab>here’s a re-usable solution:
<ArneBab>(import (ice-9 rdelim) (ice-9 popen) (rnrs io ports))(define (call-command-with-output-error-to-string cmd) (let* ((err-cons (pipe))(port (with-error-to-port (cdr err-cons) (λ()(open-input-pipe cmd))))(result (read-delimited "" port))) (close-port (cdr err-cons)) (values result (read-delimited "" (car err-cons)))))(call-command-with-output-error-to-string "echo 1; echo 2 >&2")
<minerjoe>ArneBab: works! thank you!
<ArneBab>minerjoe: not that this might deadlock: if you exceed the buffer of the pipe, it is likely to deadlock.
<minerjoe>ArneBab: I think get it now. Its due to the read from stdout preceding stderr, so if the subprocess floods the buffer it will block?
<ArneBab>yes
<ArneBab>you’d need to alternate between reading from stdout and stderr to avoid that. Suspendable ports should allow for doing that, but I don’t understand it well enough to do this quickly.
<ArneBab> https://www.gnu.org/software/guile/docs/master/guile.html/Non_002dBlocking-I_002fO.html
<RhodiumToad>the idea is that with suspendable ports, you can provide a handler that's called when there's no data yet to be read, and that handler can abort-to-prompt to get out of the pending read and do something else, such as checking whether the other port is readable
<ArneBab>That’s what I understood. What I did not understand is how I’d use its API in actual code …
<RhodiumToad>prompts are a bit brain-twisting, though
<RhodiumToad>it took me a few days to get the hang of shift/reset
<ArneBab>I wrote down the current implementation with a pointer to non-blocking IO: https://www.draketo.de/software/guile-capture-stdout-stderr.html
<pkill9>is there a plugin for emacs for command completion of guile?
<pkill9>that also describes arguments
<chrislck>Any (ice-9 match) gurus here? Qu: about (? pred?); I know we can match eg: (match item (((? item->name this) . rest) ...)) and use "this" binding.
<chrislck>Is it also possible to use the output of (item->name this), knowing the output isn't #f ???
<RhodiumToad>hm, I suspect not, but I'm not at all sure
<chrislck>It's a "would be nice to have" missing feature
<minerjoe>pkill9: I use geiser. It has autodocs.
<minerjoe>ArneBab: Nice blog. Spelling mistake "dependyng"
<ArneBab>ah, thank you!
<minerjoe>Folks, has there been movement in adding an inspector to guile+geiser, ala SLIME. Not trying to be CL is better, just a wonderful feature that I use all the time.
<ArneBab>what does it do?
<minerjoe>ArneBab: Lets you explore the entire system. Drill down into objects, lists, packages, etc.
<minerjoe>Just found (oop goops describe).
<minerjoe>So the machinery is there, I'll just need to whip up some elisp.
<ArneBab>nice!
<dsmith-work>I've heard a lot of great things about slime. Make me want to learn CL just so I can use it..
<minerjoe> dsmith-work: I've been primarily a CL developer for over 10 years. Guile+geiser is great! don't get me wrong, but it does feel more like a toy in comparison to SBCL+SLIME.
<minerjoe>That said, I wouldn't be doing what I am now with SBCL, way too heavyweight to embed.
<minerjoe>dsmith-work: Also, SLIME is great, but SLY is better.
<dsmith-work>Sylvester the Cat's Common Lisp IDE. Interesting...
<minerjoe>dsmith-work: It has a really nice integrated tracing system. You just trace up all the functions you care about, run your code, and analyze the results in a dedicated emacs buffer.
<dsmith-work>I did something in emacs the other day tracking down a problem. Might have been tracing. Was *amazing*. I want that for Guile.
<dsmith-work>Needed to instrument the function you wanted to trace.
<minerjoe>Not to jump on #guile and crap, just observations. I truly like some of the decisions that scheme made. Useing a lisp-1 is pretty cool.
<minerjoe>dsmith-work: Yea. I'ts just move the cursor to the symbol, and hit a keybinding.
<dsmith-work>Guile does have some kind of tracing, but I've neved used it. Well, I just tried to in Geiser a few days ago and it didn't go well.
<dsmith-work>Locked up the emacs<->guile connection. Had to kill emacs.
<minerjoe>I've been reading up on guile's tracing but haven't got it to work for me though. Does anyone else use ,trace? I've been trying to emulate CL's tracing with trace-calls-to-procedure but I'm not getting any output. Even the simple example in the manual is not working. I'm thinking its not returing the tracing info to the geiser port but rather it's ending out stdout(err?) which I have no access to.
<minerjoe>dsmith-work: Yea, ive noticed that geiser<->guile gets confused. One really nice thing about SLIME is that if the REPL hangs you can usually just C-c to send a signal and break into the integrated debugger. With geiser I have to close the buffer and reconnect.
<minerjoe>losing my work, as the C-c before would leave me at the stack frame that is hanging.
<minerjoe>dsmith-work: If you don't use geiser, how do you interact with guile? From the shell?
<dsmith-work>I sometimes use geiser. Mostly from shell.
<dsmith-work>I think geiser mostly looks at a scheme repl. It's looking for a prompt, for example.
<dsmith-work>While slime has it's own protocol with code that runs in the lisp process.
<minerjoe>dsmith-work: Yea, thats the fundamental difference.
<minerjoe>Wonder how much work it would be to implement the SWANK protocol in guile, which would give us SLIME.
<minerjoe>And a more robust emacs<->scheme interface.
<terpri_>minerjoe, i concur re: geiser vs. slime. geiser is generally great though
<terpri_>it's been done before for Scheme48 (SLIME48), probably a decade ago
<terpri_>there's also the possibility of supporting common lisp in guile, and simply making sure any of slime's nonstandard requirements are supported
<minerjoe>terpri_: Yea, its hard to type "constructive criticism" about people babies. I truly like geiser.
<dsmith-work>Geiser *is* great to have.
<dsmith-work>And jao is awsome too. ;^}
<pkill9>how do i trigger geiser to give me a completion?
<dsmith-work>Hmm. https://github.com/ecraven/r7rs-swank and it has https://github.com/ecraven/r7rs-swank/blob/master/specific/guile.scm
<dsmith-work>I wonder how well that works
<minerjoe>pkill9: I think it worked out of the box for me. Looking at my configs I don't see anything specific.
<pkill9>oh, i start geiser repl and now it shows me arguments in the statusbar
<pkill9>how do i have it complete a partially-written function?
<dsmith-work>C-h m might show something
<dsmith-work>Like: C-M-i completion-at-point
<a_v_p>Hello Guilers! I'm trying to use libguile with QTCreator/QMake with some success, should I say. Does anyone tried to go down this path before, or am I in a Guile wilderness somewhere?
<pkill9>nice i got autocompletion working
<pkill9>by defualt it's M-<TAB>
<pkill9>but there is geiser-smart-tab-mode so you canjust use tab
<minerjoe>dsmith-work: Tried to get the r7rs-swank to run, doesn't seem to work with latest guile. Investigating.
<pkill9>how do i make emacs run `run-guile` when it opens a scheme file?
<dsmith-work>pkill9: Don't remember off hand. Somewhere in emacs "customize" I think.
<justin_smith>surely there's a "scheme-mode-hook" where you could add your function that starts guile? that's the sort of thing I remember doing 8 years ago when I used emacs
<justin_smith> https://www.gnu.org/software/emacs/manual/html_node/emacs/Hooks.html
<justin_smith>scheme-mode-hook is listed as a standard hook here http://ftp.gnu.org/old-gnu/Manuals/elisp-manual-20-2.5/html_chapter/elisp_46.html
<dsmith-work>pkill9: My config here is minimial:
<dsmith-work>(use-package geiser
<dsmith-work> :ensure t)
<justin_smith>dsmith-work: based on the docs I linked, it should be something like (add-hook 'scheme-mode-hook 'run-guile)
<dsmith-work>Ya, something like that I have on home machines.
<justin_smith>the gotcha might be that some buffers that get scheme-mode turned on shouldn't have their own repl
<justin_smith>dsmith-work: oops, I tagged the wrong person there, meant that for pkill9
<dsmith-work>I've got a bit more for paredit: https://paste.debian.net/1157699/
<dsmith-work>justin_smith: heh. np
<minerjoe>pkill9: I doub't youd need a repl for each buffer, rather just one repl you can jump to from any scheme-mode buffer. I bind 'switch-to-geiser to an easy keybinding and then you can jump to it anytime you want.
***catonano_ is now known as catonano