IRC channel logs

2020-07-13.log

back to list of logs

<alextee[m]>g_test_init(), g_test_add_func() and g_test_run() basically
<alextee[m]>only need these 3
<alextee[m]>except add_func() adds a guile script
<civodul>alextee[m]: you sure you don't want to use srfi-64 or similar instead?
<alextee[m]>i want to replace my C unit tests (for example https://git.zrythm.org/cgit/zrythm/tree/tests/actions/copy_tracks.c) with guile, since i already exposed the functions used in the tests to guile
<alextee[m]>civodul: oh this looks nice! i can just somehow include my custom modules and then do the work with srfi-64
<alextee[m]>thanks
<alextee[m]>i think i might need a little C interface to kick off the guile tests after exposing my custom modules from C
<rlb>civodul: I noticed that clojure's lein now produces a default project license that's not just eclipse, it's dual: eclipse or GPLv2+ with classpath exception. For projects that might want to straddle both worlds (eclipse and fsf) any idea offhand which is preferable between lein's choice or say epl + lgpl? (I'm not all that familiar with the classpath side).
<hendursaga>Apologies, I'm still making my way through the Guile reference manual - how would I easily modify %base-services so that I can configure network-manager-service-type, or work around it?
<hendursaga>Sorry that was for #guix
<dsmith>Apology Accepted, hendursaga
<tohoyn>sneek, botsnack
<sneek>:)
<kahiru>hey, I was wondering, if both let and define create local bindings, is one preferred over the other?
***apteryx_ is now known as apteryx
<alextee[m]>what's the easiest way to pass configuration data to a guile script?
<alextee[m]>similar to how you would pass it in C, like #include "config.h"
<alextee[m]>i have the configuration dictionary in meson but i'm unsure in what format i should pass it to guile
<alextee[m]>(it contains things like HAVE_THIS_FEATURE: true, HAVE_ANOTHER_FEATURE: true)
<ArneBab>alextee[m]: I’d use either an alist (to check with (assoc key the-alist))
<ArneBab>alextee[m]: or create a record (define-record-type …)
<ArneBab>the advantage of the record is that the format is clearly defined. The disadvantage is that it’s harder to change and more code.
<ArneBab>I’m not sure whether there’s a better way — maybe wait for others here …
<alextee[m]>oh hmm
<alextee[m]>maybe just (define key "value") for each one
<alextee[m]>that way i can just do (if key ...)
<alextee[m]>thanks anyway :-)
<alextee[m]>omg this is awesome! i wrote a unit test in guile!
<kahiru>alextee[m]: can I see?
<alextee[m]>kahiru: this is my test runner https://git.zrythm.org/cgit/zrythm/tree/tests/guile_runner.c
<alextee[m]>and here is my test:
*alextee[m] sent a long message: < https://matrix.org/_matrix/media/r0/download/matrix.org/DLhgjjxesLqZseRfJmFJcqdi >
<alextee[m]>those modules are exposed in each file in src/guile in that repository
<kahiru>cool
<dsmith-work>UGT Greetings, Guilers
<mwette>howdy!
<justin_smith>kahiru: an advantage of let, all else being equal, is that the let form imposes a predictable structure where bindings are created then used, which is useful for macros and preferred by some human users
<kahiru>makes sense, thanks
<davidl>are there any SCA tools for guile?
<davidl>like this is the kind of stuff that everyone wants now or will soon want/require: https://www.kiuwan.com/languages/ and if Guile doesn't have it, Im not sure how much Ill be able to use it in the future in a business environment.
<justin_smith>davidl: I've had poor luck finding such tools for lisps, the tools tend to be pretty shallow and require a level of predictability that's less common when you have powerful macros
<davidl>justin_smith: it's unfortunate. "tend to be pretty shallow" - so you know of some tools at all? I haven't found any. Could you name some tools you know of?
<justin_smith>davidl: I mean the ones that are implemented for other languages are shallow
<davidl>aha ok
<justin_smith>that kind of shallow analysis doesn't cut it in a lisp with a real macro system
<justin_smith>otherwise they could do bytecode / object code level analysis, but you have to pay individual human beings to analyse that (there are tools that help but they only go so far)
<justin_smith>I mean, if you think for a moment about the domain, it's halting problem complete
<justin_smith>if you look at the sources of most real security bugs (unchecked array access, arbitrary side effecting code inside data constructors), we should be far ahead of the game :/
<justin_smith>but we don't have static code that can prove it
<davidl>justin_smith: I do not understand "halting problem complete", but what you are saying is very interesting. I would love to read some blog post around these issues that centers around guile or lisps in general.
<justin_smith>davidl: what I mean is that the halting problem says you can't (in the general case) prove a program doesn't do X without running the program. There's always the pathological case that violates your analytic constraints (usually proven by taking the analyzer itself as an input)
<justin_smith>davidl: yeah, it would be a good topic for a blog post, I'm getting laid off in a couple months might even have a chance to write it up properly
***drmeister_ is now known as drmeister
<ArneBab>You can actually prove subsets of programs — the little prover explains a lot there, but feels like it’s built to build compilers: https://mitpress.mit.edu/books/little-prover
<ArneBab>also if you can constrain the inputs, you can constrain the outputs.
<ArneBab>(though I don’t know whether my reply really answers your question)
***sneek_ is now known as sneek
<justin_smith>ArneBab: yeah, these things are true, but the existing static analysis tools are just fuzzy matchers for common bugs (failing to check bounds, not sanitising input to certain constructors etc.)
<tinga>Hi. Is there syntax foo somewhere for something between case and cond, so that (foo c (bar? 1) (baz? 2)) is the same as (cond ((bar? c) 1) ((baz? c) 2))?
<chrislck>tinga: try (ice-9 match)
<tinga>Thanks, checking
<tinga>Not sure how you'd do it, via (? predicate pat_1 ... pat_n) ?
<tinga>(looking at https://www.gnu.org/software/guile/docs/docs-2.0/guile-ref/Pattern-Matching.html)
<chrislck>(match c ((? bar?) 1) ((? baz?) 2))
<tinga>OK
***hugh_marera_ is now known as hugh_marera
<mfg>hi, does the mkdir function create paths like mkdir -p ?
<justin_smith>mfg: a quick try tells me no (fails with "no such file or directory")
<justin_smith>it should be easy to make parts of a path in a loop though
<mfg>hm okay, that's what is suspected too. building the path up is the way to go then :)
<justin_smith>this works - (for-each mkdir '("foo" "foo/bar" "foo/bar/baz"))
<mfg>thank you
<mfg>ah this is rather short! nice
<leoprikler>there's also a mkdir-p in guix, check it out ;)
<justin_smith>you could make a small function to take foo/bar/baz and generate (foo foo/bar foo/bar/baz)
<mfg>leoprikler: in what module is it?
<leoprikler>(guix build utils)
<mfg>nice thx :)