IRC channel logs

2022-08-12.log

back to list of logs

***devmsv_ is now known as devmsv
<unmatched-paren>hello guilers, is it possible to get the path to the guile binary being used to run the current file?
<unmatched-paren>and the equivalent guild binary, maybe?
<lloda>(car (program-arguments)), depending on how it was called
<unmatched-paren>that prints the name of the script being run, not the `guile` binary running the script
<tohoyn>unmatched-paren: maybe (system "ps <proper arguments>") and (getpid)
<unmatched-paren>tohoyn: I think I'll just look it up in PATH, but thanks
<mwette>unmatched-paren: (readlink "/proc/self/exe")
<apteryx>is there a 'call-with-temporary-file' in guile?
<mwette>there is mkstemp
<mwette>oh, but file not deleted automatically
<dsmith-work>Happy Friday, Guilers!!
<tohoyn>apteryx: see https://paste.debian.net/1250171/. I have not tested it.
<apteryx>tohoyn: looks good, but I'd use dynamic-wind for the cleanup
<apteryx>also, can we have it in Guile proper? :-)
<dthompson>I've wanted a call-with-temporary-file a number of times. would be cool to have in the guile standard library.
<unmatched-paren>maybe there could be a more abstract (with-files) macro, something like (with-files ((f1 "path/to/f1.text" #:read #t) (f2 'temporary #:read #t #:append #t) ...) ...)
<unmatched-paren>could also be called let-files i guess
<Mudskipper875>mwette: I never knew about /proc/self/exe. Very useful, thanks!
***daviid`` is now known as daviid
<apteryx>tohoyn: your version could be improved with call-with-port, which would remove the need for cleanup
<tohoyn>apteryx: ok
<samplet>IIRC, the Scheme standard says it cleans up only if the procedure returns normally. So it doesn’t do cleanup for exceptions, say. This is in case the programmer wants to engage in continuation shenanigans.
<samplet>“If PROC does not return, then the port must not be closed automatically unless it is possible to prove that the port will never again be used [...].”
<samplet>Looking at the implementation, Guile follows the spec. (I’ve been confused by this before, so I thought I would mention it.)
<unmatched-paren>i ended up writing my configure script in guile instead of shell. it seems to generate config.mk properly. https://paste.sr.ht/~unmatched-paren/a01d20d2b1496f600140a0393f5f99c20b802b16
<lilyp>why not use potato make? :P
<apteryx>samplet: ah, thanks for pointing that
***karlosz_ is now known as karlosz
<mwette>unmatched-paren: I think you want "${@}" not ${@}
<mwette>or just "$@"
<unmatched-paren>mwette: thanks
<apteryx>mkstemp is a bit odd; it forces you to pass that XXXXXX static string, although it can't be any different. It also doesn't use it as a template (you can't suffix it with more non-template characters)
<apteryx>e.g., (mkstemp "/tmp/screenshot-XXXXXX.ppm") is invalid
<dsmith-work>Can't use a literal (constant, non-mutable) string.
<dsmith-work>Well, in C you can't.
<apteryx>I see.
<dsmith-work>"The last six characters of template must be "XXXXXX" and these are replaced with a string that makes the filename unique. Since it will be modified, template must not be a string constant, but should be declared as a character array."
<dsmith-work>From man page
<mwette>on how dispatch is performed in julia: https://github.com/JuliaLang/julia/blob/master/doc/src/devdocs/functions.md
<unmatched-paren>what could this backtrace possibly mean? https://paste.sr.ht/~unmatched-paren/3acd69d4c62267afc8c919a69321b112c97ed805
<mwette>unmatched-paren: sometimes you get more info if you compile your code with "guild compile -O0"; others have said "-O1" works also
<unmatched-paren>mwette: thanks