IRC channel logs
2023-05-12.log
back to list of logs
<RhodiumToad>when wrapping a C API using goops and the FFI, there are a bunch of C functions that return a string or NULL, and a bunch that take a string or NULL as parameters <RhodiumToad>returning a string or #f to represent a null is obviously easy <RhodiumToad>but then a method defined as (foo (self <myobject>) (str <string>)) won't match <rlb>RhodiumToad: hmm, suspect it might not be apropos here, but on the clojure/jvm/lokke side, that might be translated as #nil, i.e. NULL <-> #nil. <RhodiumToad>so... two methods? or make a <string-or-null> class? <RhodiumToad>scheme doesn't really have a #nil, though guile does for compatibility with elisp <rlb>Right, that'd only be OK if this were guile/elisp/clj-specific. <RhodiumToad>but that wouldn't help anyway, because #nil is still not a string <rlb>Sure, but you said they take string or null. <rlb>...and #nil would be automatically translated to NULL for those args, but I suspect I don't understand the context. <RhodiumToad>where "some property" at the C level is a char* that might be NULL <rlb>The way I was imagining, NULL would be returned as #nil, and when #nil was passed in to the functions expecting NULL or string, it'd be converted back to NULL... <RhodiumToad>if set-some-property is defined as a method taking <string>, then it won't even be called if the value is #nil (or #f) <rlb>Right, you'd have to define multiple methods (at least what lokke does). <rlb>And it's a little tricky since you can't bind "just #nil"... <RhodiumToad>right, I think it will match as if it were <boolean> but I'd have to check <rlb>(set/union #nil) -> #nil <daviid>RhodiumToad: what C API are you wrapping? just curious <RhodiumToad>I did a mostly-working version a while back as a side project, now I'm doing a bit more on it since I found a potential new use for it <daviid>nice - it looks like a difficult lib to wrap :) <RhodiumToad>the hard part is dealing with object ownership for entries, because entries have pointers back to the archive object, and if the archive is closed the entries have to be managed safely <ArneBab>There’s a paid internship offer with the Greens in Brussels that needs Guix and Guile skills: https://www.greens-efa.eu/en/get-involved/work-with-us — I thought you may be interested. Deadline for application: 31 May, 23:59 CET — info about needed skills is from an email of a green elected: Internal toolchain development, debugging or maintenance, using Guile Scheme, Guix, PHP (Drupal / CiviCRM), bash, postgres, sqlite and similar <RhodiumToad>woo, looks like I can actually create archives now with guile-libarchive <old>RhodiumToad: what type of archive? <RhodiumToad>tar, pax, cpio, 7z, ar (might not work), iso9660, zip, some others <RhodiumToad>(make-archive "testdata" "x.iso") and it'll deduce the format from the filename <old>I've been hacking a small module to call `tar' behind the scene with open-pipe for my use case <old>but having a ffi to a strong library is much better <old>planned to publish on Guix? <RhodiumToad>readme isn't up to date, disk read support and ACLs are done <ArneBab>civodul: that looks like a non-internship job? (the one I posted is for paid interns) <RhodiumToad>extracting archives to disk isn't really done (you can read archives including reading the data, but there's no <archive-disk-write> object yet) <RhodiumToad>the interesting thing that I'm looking at is that it gives you the ability to arbitrarily frobnicate the various file attributes between disk and archive, so you can change the ownership, permissions, flags etc. <bjc>does guile have an advice-like mechanism? i'm trying to get some debugging output out of ‘utime’, which isn't logging the filename it failed on <jpoiret>bjc: guile has lexical binding so this will not affect utime uses unless they're exactly in the lambda* body <bjc>i assume i have to convince guile that i'm modifying the symbol in the ‘guile’ package, but i dunno how to do that <old>bjc: you want tracing <old>guile can insert tracepoint in the bytecode of a function IIRC <old>> ,trace (utime "foo") in the REPL <old>for in script hold one <old>gotta run the script with `--debug' <bjc>thanks, i'll give it a whirl <bjc>is there an environment variable i can set? i can't modify the script <bjc>i've tried just putting (set-vm-trace-level! 10) in the code, but it didn't seem to work. i'm flying blind, though. it's hard for me to find more info in the manual; this is just from using info's index <old>what about you run another script <old>that load the script that you can't modify <bjc>that can't change the argv of the call to guile of the internal script <bjc>eh, i just modified the guix script to add --debug, and i'm still getting nothing =/