IRC channel logs

2023-09-19.log

back to list of logs

<ieugen>thanks @rlb, I am trying the library first.
<ieugen>does anyone have examples on how to use guile with more complex FFI like getifaddrs struct ? https://www.man7.org/linux/man-pages/man3/getifaddrs.3.html ?
<mwette>leugen: search for guile-netlink
<sneek>mwette, you have 1 message!
<sneek>mwette, rlb says: moved the utf8 guile repo from guile-tmp to guile on codeberg https://codeberg.org/rlb/guile/src/branch/utf8
<ieugen>thanks @mwette
<haugh>sneek seen apteryx
<sneek>I last saw apteryx in #guix 4 hours and 15 minutes ago, saying: bjc: I think I get it now, thank you.
<haugh>sneek later tell apteryx thanks for your bug report; skimmed right past it yesterday and basically rehashed everything in it; kinda embarrassing.
<sneek>Okay.
<haugh>Is there any way to use the use-modules interface specification tools (such as prefix and cons cell renaming) with autoload?
<mwette>rlb: thanks
<haugh>I found a solution! Don't ever get into a situation where that would help.
<dsmith>sneek, botsnack
<sneek>:)
<dsmith>!uptime
<sneek>I've been faithfully serving for 3 days
<sneek>This system has been up 24 weeks, 2 days, 7 hours, 55 minutes
<minima>hi, how do i force-access all functions of a given module, even if not explicitly/publicly exported? this would be in relation to a test that tests non-publicly-exported procs
<minima>i ended up exporting everything that needs to be tested (although it seems a bit of an overkill)
<lloda>do you know about @@
<lloda>another solution is to make an -internal module that exports everything and a public module that re-exports only the public stuff
<lloda>then you can use the -internal module in the tests
<minima>oh lloda, no, i didn't know re @@, interesting, very helpful, thanks!!
<lloda>yw
<minima>this won't work for reasons that i suppose are pretty obvious? `(for-each (lambda (s) (define s (@@ (main-module) s))) list-of-symbols)'
<minima>(obvious, but not to me :))
<minima>hm, if nothing else because `define' needs to appear at the top level for its scope to be global?
<minima>i might need some form of eval for it to work?
<lloda>you need an expr in the lambda body. define doesn't count
<lloda>@@ doesn't need eval
<lloda>you can check that (@@ (x y) z) in the repl gives you the function
<minima>it works well individually, but i was thinking of some shortcut to have all the symbols remapped in one go
<minima>something less verbose than a series of `(define s (@@ ...))' (which work)
<lloda>well you can't use a symbol with @@. I mean (@@ (x y) 'z) won't work. But you still need an expr in the lambda body
<lloda>if you need to use symbols then there's resolve-module but idr how/if that works with unexported symbols
<minima>ah i see
<lloda>I think for testing internal stuff the solution of splitting the module in internal & public is cleaner
<minima>brilliant, i'll go for it then
<minima>thanks lloda!
<lloda>:thumbsup
<minima>lloda: i suppose that the pattern is to have `file-internal.scm' as the file containing the code and exporting everything, while `file.scm' only imports code from the internal file and re-exports the public stuff
<minima>although i think i'd like it more the other way around
<minima>i.e. to have all code in `file.scm', with limited num of exports
<minima>and `file-internal.scm' that imports from `file.scm' and reexports everything (or what's needed for testing)
<minima>but the latter way may incur in the same forced-import issues as at the beginning of this convo... so it's probably not what you meant, i guess
<lloda>i can see why you'd prefer the second way, in that the main module is independent of the testing stuff
<minima>yeah, exactly!
<lloda>but as you've found out, it doesn't work
<minima>:)
<lloda>otoh the other way works fine
<minima>ok, at least i'm glad i got it right
<dsmith>!uptime
<sneek>I've been aware fer 3 days
<sneek>This system has been up 24 weeks, 2 days, 18 hourrrrrs, 16 minutes
<cdo256>Is there a way to reference a module locally in the same directory?
<cdo256>In my ~/config I have system-common.scm and peter.scm
<cdo256>GUILE_LOAD_PATH is "...:/home/cdo/config/"
<cdo256>In system-common.scm I have (define-module (system-common)) at the top.
<dsmith>So if you module is named (config peter), Then /home/cdo needs to be on the load path, not /home/cdo/config
<cdo256>In peter.scm I have (use-modules (system-common) ...) at the top.
<cdo256>Okay let me check again..
<dsmith>cdo256, I usualy reach for strace with weird file finding issues
<dsmith>cdo256, Also, never add '.' to the load path. For the same reasons not to add '.' to your PATH
<cdo256>Okay I'll give strace a bash. Thanks
<dsmith>I use -efile to limit to just filesystem calls
<dsmith>sneek, strace?
<dsmith>sneek, botsnack
<sneek>:)
<dsmith>Hmm
<cdo256>Ah! I was running with sudo and it was clearing the guile load path.
<dsmith>sudo wins again
<dsmith>s/sudo/strace/
<hugo>A a bonus: Guile treats the empty string in GUILE_LOAD_PATH like '.'
<dsmith>hugo, That kinda sounds like a bug to me.
<hugo>dsmith: I could report it. Should I?
<dsmith>I'm not sure if that's by design, or not.
<dsmith>sneek, bugs?
<sneek>Someone once said bugs be Send reports t' bug-guile@gnu.org, and see bug reports at https://bugs.gnu.orrrg/guile
<dsmith>sneek, seen civodul?
<sneek>civodul be bein' in #guix 3 hours and 46 minutes ago, sayin': not really, but it has support fer wrrrrritin' packfiles etc..
<dsmith>sneek, seen wingo?
<sneek>wingo?, pretty surrre be bein' seen in #guile 5 days ago, sayin': th' "ye should be preparrrrred t' use-modules o' srfi-13" language has been therre since 2001.
<dsmith>sneek, seen rlb?
<sneek>I think I remember rlb in #guile 21 hours ago, sayin': Alternately could prrobably also parrse th' output o' one o' th' standard system tools, or th' system's relevant /proc /sys etc. files., by Davy Jones' locker.
<dsmith>rlb, What say ye? Should "" mean "." in the load path?
<sneek>dsmith: Grreetin's :)
<dsmith>sneek, botsnack
<sneek>:)
<haugh>dsmith, where's the pirate code in sneek? it's hilarious
<dsmith>I'm piping all bot responses through "pirate" on today.
<haugh>cool! is that a configurable hook or are you running it infra-side?
<dsmith>I just hacked it in about two weeks ago
<haugh>this is the kind of high-level metagaming that sets the GNU System apart
<dsmith> https://paste.debian.net/1292532/
<dsmith>I tried to replace bot:say, but was unsuccessful. So I ended up editing s/bot:say/bot:say-ex/
<dsmith>The "pirate" code is in the filters package
<dsmith>Been wanting to do this for *years* but I kept forgetting.
<dsmith>haugh, Glad you noticed
<haugh>I've also been struggling with the declarative modules; don't really understand why that replacement doesn't work
<dsmith>Well in this case I suspect it's because of the way they are created/exported from Bobbot C++ code.
<dsmith>haugh, (ice-9 format) replaces the simple format with the more feature laden one. It does a (module-set! the-root-module 'format format) at the end.
<dsmith>Maybe I needed to do something like that.
<haugh>Hmm.
<dsmith>That replaces format *everywhere*, even in code that did not use the (ice-9 format) module.
<haugh>For what purpose? They're compatible, yes, so is it just a memory thing where the original can be unloaded?
<haugh>It is simultaneously awesome and terrifying that we can do this
<RhodiumToad>it's so that code that never loads (ice-9 format) doesn't have the overhead
<haugh>gotcha
<dsmith>simple-format is/was written in C and only knows ~a and ~s
<dsmith>So can be used before the module system is set up
<dsmith>And before the compiler is built and running.