IRC channel logs

2020-09-25.log

back to list of logs

<roptat>mh... I have a variable, say (define val 0), then I try something like this: (case 0 ((val) #t)) but I get #<unspecified> instead of #t
<roptat>I understand it compares with the symbol, but how can I make it compare with the value of the variable?
<dsmith-work>roptat: Probably better off using cond
<justin_smith>case needs to build a dispatch table and only uses compile time literals - (case 'val ((val) #t)) -> #t
<dsmith-work> https://www.gnu.org/software/guile/manual/html_node/Conditionals.html#index-case-1
<dsmith-work>It expect one or more "datum"s
<dsmith-work>Effectively, a literal constant.
<roptat>thanks
<dsmith-work>Pretty much like a case in a C switch statement. If you are familiar with C. (Seems like most people are not these days...)
<justin_smith>in some implementations case compiles directly to a hash table lookup (it works the same way in clojure, and there they construct a hash table from the matching values to the byte code to run)
<dsmith-work>And in Guile, wingo recently added table lookups. In git, not yet released. (Woo!)
<justin_smith>fun
<leoprikler>roptat: out of interest, what were you trying to achieve here?
<leoprikler>comparing 0 against a bunch of variables to find the first one that's 0?
<roptat>no, I have a type variable (an integer), and depending on that type, I want to return a specific function that handles that type
<roptat>I'm trying to implement the netlink protocol, so I need to match the type with e.g. NETLINK_ROUTE or NLMSG_ERROR, etc
<roptat>I managed to do what I want, now I can see all the attributes of a link, by its id
<roptat>so I'm pretty happy :)
<roptat>I still need to decode errors properly though ^^'
<spk121>hello guile. Can I safely ignore this warning "WARNING: Use of `load' in declarative module (gi core-generics). Add #:declarative? #f to your define-module invocation." ?
***jonsger1 is now known as jonsger
<daviid>spk121: i don't have any valuable experience with 3.0, and although it compiles g-golf, any attempt to use it fails - but I think you only may ignore if the load does not affect any (gi core-generics) to-level binding, and checks pass as in 2.2 - a tiny 2c :)
<sneek>Welcome back daviid, you have 2 messages!
<sneek>daviid, str1ngs says: Hello, I think this is a limitation with WebKitView and not g-golf. But to use webkit_web_view_get_tls_info it requires GTlsCertificate and I don't think there is a way to do that with g-golf or GI in general? unless I'm missing something. see https://webkitgtk.org/reference/webkit2gtk/stable/WebKitWebView.html#webkit-web-view-get-tls-info
<sneek>daviid, str1ngs says: I mean there is no way to instantiate a GTlsCertificate
<spk121>daviid: thanks
<roptat>oh, is there a way to get a string from an errno number?
<spk121>roptat: strerror
<roptat>ah thanks
<daviid>str1ngs: i did see your msg and itented to answer ... I think it should work in g-golf, and probably is a g-golf limitation/missing feature or bug - let's work on it asa I finalize my fix for the methods related bug you found ... I am on it, almost done, i think :) but still a 'corner case'
<daviid>str1ngs: if you can prepare a minimal example ... that also uses gtk-init / gtk-main, for debugging purposes - the main reason is that when using gtk-application and g-application-run, we totally loose the 'dynamic' characteristic of lisp/scheme, you can't re-compile something in g-golf and launch the app, it complains it already exists one app ... then you have to quite guile, make make install g-golf, start again, import g-golf, load
<daviid>the app and call main ... a real pita
<daviid>str1ngs: fwiw, here is what i wrote to debug the notebook/append-page bug you found - which I am still working on ... if/when possible, please re-use it as a 'template', for the webkit_web_view_get_tls_info related bug or any future 'debugging snipset', many tx!
<daviid>str1ngs: here https://paste.debian.net/1164592/ - yes, i could have refactored part of the button1/button2 callback, but that's ok ...
<daviid>str1ngs: with that kind of 'debugging snipset', I can load the code, call (main '()), demand a full backtrace, work on g-golf, hit C-x C-e (emacs/geiser) and call (main '()) again ...
<daviid>like i could, using lucid, nearlye 30y ago :):)
<str1ngs>It's not as much of PITA then having to write a whole program just to report a bug. I wouldn't even mind these making these examples if there were actually going to be used as examples at some point. but you refused that contribution even.
<daviid>str1ngs: the notebook code you padsted was unusable - as a debufgin snipset
<daviid>and gtk-application, g-application-run is a problem, as i explained ... i actually didask the introspection authors, if there wa a way to de-register dynamically, but they told me you'd better quit and restart your environment
<daviid>it's noty a whole program, it's a fewe lines of code, most already written, by myself ...
<daviid>the pita is to loose the dynamic environment
<daviid>please re-use that snipset in the future, tx
<str1ngs>I'm not giving examples giving examples anymore then. They are for my benefit not yours. I'll report the bug you do with it as you will. your turning my bug reports into the examples themselves without actually dealing the bugs.
***apteryx_ is now known as apteryx
<dsmith-work>Happy Friday, Guilers!!
<civodul>hey dsmith-work, happy Friday all!
*sneek does the friday dance
<civodul>sneek: botsnack
<sneek>:)
<mwette>Yes. Happy Friday!
<leoprikler>spk121: regarding that question, if it's about guile-gi there is not even an actual use of `load' IIRC
<leoprikler>The complaint stems from wrapping `load' in a GOOPS method
<spk121>leoprikler: heh, interesting. I didn't actually check for a 'load' in the module. It is just a new warning I noticed when I moved the Docker build from guile-2.2 to guile-3.0
<roptat>I'd like to have a macro to define an enum (or maybe that already exists in guile?) so that I could do (define-enum message-type NLMSG_NOOP NLMSG_ERROR NLMSG_DONE (RTM_NEWLINK 16) RTM_DELLINK) etc, and it would define NLMSG_NOOP=1, NLMSG_ERROR=2, RTM_DELLINK=17, etc
<civodul>roptat: there's define-enumerate-type in Guix
<civodul>in several places actually...
<roptat>oh
<RhodiumToad>how does an enum differ from just defining a bunch of symbols?
<civodul>but it's only 6 lines
<civodul>RhodiumToad: you get macro-expansion-time checks
<roptat>I'd like also to have the reverse: (get-message-type RTM_DELLINK) -> 'RTM_DELLINK
<civodul>you can't make a typo in a symbol and notice it only at run time
<RhodiumToad>oh, defining them as macros?
***rekado_ is now known as rekado
*rekado <3 define-enumerate-type
<roptat>so what I understand from define-enumerate-type is that it does symbol->int, but not the other way around
<civodul>yes
<civodul>you can find more elaborate variants elsewhere :-)
<civodul>it's ridiculous, i think i've implemented it ten times
<civodul>guile-gcrypt has one that's pretty cool
<rekado>I’m just started playing with OpenAL, which I want to use as a glorified audio mixer.
<rekado>I’m thinking about whether to extend Guile or link the application with Guile
<rekado>all I want is to be able to control the core of the application from the outside
<civodul>extend!
<rekado>I knew you’d say that :)
<civodul>:-)
<rekado>as I envision it, the application will listen for connections on a socket, which tell it to add, remove, or reposition audio sources and listeners.
<rekado>extending seems like more work
<str1ngs>extending means you can use a REPL tough :)
<civodul>more work because it's harder to do from Guile than from C(++)?
<rekado>more work because I’d have to wrap more OpenAL things
<civodul>ah yes
<civodul>try nyacc's ffi generator while mwette is around :-)
<rekado>I’m afraid of GC issues, to be honest. Like some object disappearing too early, causing crashes.
<rekado>so the prototype needs to remain simple, leaving me time to learn more.
<rekado>(and to shed fear)
<rekado>I’ll try extending
<rekado>manually first
<rekado>if that all works I might give the ffi generator a spin
<civodul>sounds reasonable
<rekado>I know I really shouldn’t play with all this, but I just can’t help it.
<rekado>this might be fun
<civodul>i know that feeling
<civodul>i've come to the conclusion that sometimes you just need to go ahead and scratch your itch
<rekado>I’m writing this surrounded by three to four 70-90% finished projects… (a drum synth, a pre-amp / effects box, a shelf, and unfinished ethernet cabling in the walls…)
<rekado>productive procrastination
<civodul>next you can start a "museum of unfinished stuff" project!
<civodul>i could contribute a few pieces :-)
<rekado>hah :)
<dsmith-work>So many projects, so little time..
<rekado>neato, this works!
<civodul>as in it makes sound?
<rekado>yes
<rekado>and I can attach sound sources
<rekado>from the REPL
<civodul>nice
<civodul>rekado: that was fast!
<mwette>once you download nyacc, you an do this: https://paste.debian.net/1164672/
<mwette>or install, create the .ffi file and run guild compile-ffi
<stis>tjena guilers!
<leoprikler>is there a nyacc for guile-3 yet?
<mwette>I'm running w/ guile-3.0.4. Is there any issue identified? Or are you talking about guix?
<civodul>the nyacc package in Guix is still on Guile 2.2, but perhaps there's no good reason for that
<mwette>I don't (really) use guix so I don't know.
<rekado>that was fun, but maybe OpenAL is not the right tool for me after all.
<civodul>heh
<rekado>looks like Mumble/Murmur has a plugin for positional audio. Perfect! So I guess it’s just a matter of adding enough chewing gum between these parts and see if that works.