IRC channel logs

2022-05-23.log

back to list of logs

***chris is now known as Guest2326
***Guest2326 is now known as chrislck
***roptat is now known as Guest8033
***Server sets mode: +ntz
<lampilelo>so open-pipe* with OPEN_BOTH is kinda useless if the process expects eof in the input before outputing stuff, it would be nice if close-output-port and close-input-port did something else than just close-port to input/output ports
<lampilelo>is there a more idiomatic way of doing stuff like this? https://dpaste.com/6XB82YGUL.txt
<civodul>lampilelo: hi! no good solution, shutdown(2) is not applicable here unfortunately
<civodul>i think i solved it before though but i can't remember how
<civodul>you probably have to roll your own
<lampilelo>maybe open-process should be exported and documented
<lampilelo>because my version with a pipeline looks like a hack
<civodul>yeah, we need better interfaces in this area
<lampilelo>yeah, i feel like every time i use (ice-9 popen) i have to solve the same issues over and over again
<civodul>maybe we should start anew, with a new module, exposing an interface known to have passed the test of time, like that of Racket maybe
<lampilelo>i think just making close-(input|output)-port work on bidi ports and documenting it would be enough, although these functions are part of r6rs, so i don't really know
<civodul>lampilelo: the only syscall that lets you close just one end of a connection is shutdown(2) though
<civodul>well
<civodul>we'd need to expose the fact that there are in fact two pipes (two ports)
<chrislck>sneek: botsnack
<sneek>:)
<tohoyn>sneek: botsnack
<sneek>:)
***Avichi is now known as Avici
<dsmith-work>Hey Hi Howdy, Guilers
<dsmith-work>!uptime
<sneek>I've been running for 4 days
<sneek>This system has been up 6 weeks, 15 hours, 54 minutes
<lechner>Hi, I saw this about calling Scheme from C but do not understand how to use it. Is there an example? Thanks! https://www.gnu.org/software/guile/manual/html_node/Accessing-Modules-from-C.html
<lampilelo>lechner: you know, there's a lot of functions on that page and there is an example as well, so you need to be more specific on what you want to do
<lechner>lampilelo: thanks for making me look at the examples. i had missed the scm_call_1. is there an scm_call_3, as well?
<lampilelo>lechner: yes
<lampilelo>it goes from 0 to 9
<lampilelo> https://www.gnu.org/software/guile/manual/html_node/Fly-Evaluation.html
<lechner>lampilelo: thanks! i just found it via google. duckduckgo did not find it. i think that'swhat i'm looking for
<dsmith-work>Does not go to 11 ...
<lampilelo>lechner: it would probably be easier to browse the documentation using 'info guile' or emacs info-mode
<lechner>lampilelo: thanks!
<lampilelo>dsmith-work: goest to n!
<lampilelo>goes*
<lechner>Hi, why is scm_variable_ref needed before using eval_string_var in scm_cal_1 please? https://www.gnu.org/software/guile/manual/html_node/Accessing-Modules-from-C.html
<lampilelo>lechner: because scm_c_public_lookup() returns a variable holding a reference to the function, so you need to dereference it before the call, you can use scm_c_public_ref() to do it in one go
<lampilelo>this type of variable: https://www.gnu.org/software/guile/manual/html_node/Variables.html
<lechner>thanks. i'm a scheme noobie. just using a variable does not produce its value?
<lampilelo>it's like returning *var in C, you need to do var->fun to access what's inside the var object
<lechner>i see
<lechner>maybe my question is why scm_call_1 does not do that for you
<lampilelo>or perhaps var->value would be a better analogy
<lechner>in my case it is a fun
<lampilelo>yeah, but in scheme value of a variable can be a procedure or anything else, since it's a lisp-1
<lampilelo>and scm_call doesn't dispatch on a type, it's pretty low level
<lechner>okay, thanks!
<lechner>Hi, is this the shortest way to create a SCM list of strings from C? https://paste.debian.net/1241791/
<dsmith-work>lampilelo: Yeah!
<dsmith-work>lechner: ISTR some kind of argv->list function. Maybe it was in Scheme?
*dsmith-work looks
<dsmith-work>lechner: There is scm_makfromstrs in libguile/strings.c
<lampilelo>lechner: regardless, you shouldn't make a list by repeatedly calling scm_append, you should use scm_cons instead and if you must have it in the same odrer as the input, reverse the for loop or use scm_reverse (or scm_reverse_x to destructively alter the list)
<lechner>lampilelo: ah, yes. i could not find it in the docs
<lampilelo>scm_append will walk over the whole list every time and then put stuff at the end of it, so calling it in a loop has pretty bad algorithmic complexity
<lechner>dsmith-work: thanks!
<lechner>now browsing via info
<lechner>hi, do i have to worry about freeing those SCM vars, or just C strings?
<lechner> gnu
<lechner>sorry
<lampilelo>SCMs are managed by the garbage collector