<chrislck>alextee[m]: instead of (unless (eq? (length args) 13) ...) you can actually insert a second MATCH clause with (_ (display "Need 12 arguments") ..etc..) where _ is the 'anything else' match clause <chrislck>next, now that (main . args) now only does (match args ...), you can now (define main (match-lambda ((this output-file ...)) (_ (display "error"))) thereby can eliminate args ***apteryx is now known as Guest28000
***apteryx_ is now known as apteryx
<rekado_>alextee[m]: instead of reading character by character you could use (dump-port source target) to put everything from the source port (an opened file port) to the target port (e.g. an output file) <edoput>good morning, is there any guidance on how to do FFI with guile from the community? I've read about SMOB, new foreign types, snarfing macros and finally the dynamic FFI and I'm lost now. It would really help if I could know which approach is useful when, e.g. I guess I should define new types when I want to manipulate them as scheme values but is then required to always add the C layer when I can do dynamic <edoput>the dynamic FFI does not expose C structs as scheme values right? I would still need to do this bindings myself? <chrislck>alextee[m]: finally, as much as I love match, I think you can use case-lambda instead, which removes the need to import ice-9 match <brendyyn>civodul: with (gcrypt mac), is there way to conveniently specify algorithm and get it's length. mac-algorithm just takes an unquoted symbol and returns the id number for it. lookup-mac-algorithm appears to be the same except you give it a quoted symbol. mac-size can't take either and must actually receive the id number, so you must do something like (mac-size (lookup-mac-algorithm 'hmac-sha256)). <brendyyn>As a user of the module I'd just like to specify the hash, and get the size of. going via this internal gcrypt number is breaking the abstraction layer it seems. i cant do (mac-size 'hmac-sha256) <civodul>the "number" is actually an opaque object representing a hash algorithm <civodul>it turns out to not be so opaque, i admit <brendyyn>i mean, on a serious note, do you think thats how it should be? <civodul>ideally with a disjoint type for hash algorithms <brendyyn>what's the difference between mac-algorithm and lookup-math-algorithm? <civodul>try: ,expand (mac-algorithm hmac-sha256) <civodul>with an expansion-time error if you pass an incorrect name <brendyyn>I have almost finished implementing HKDF (RFC 5869) <civodul>conversely, lookup-mac-algorithm is a run-time thing <brendyyn>ok but why should those two different things exist? <brendyyn>I'm implementing SPAKE2. it's what Magic Wormhole uses. i plan to implement the whole thing in guile. You can lookup that on youtube <brendyyn>I've never written a macro before, and have only really experienced the fact that they make things confusing and obscure errors. <civodul>there's some truth regarding obscure errors, it's a known issue <brendyyn>im just trying to get to understand things. My simple brain says (mac-algorithm hmac-sha256) and (mac-size hmac-sha256) seem perfectly logical and provide the module user with what they want? <civodul>a "hash algorithm" is something returned by mac-algorithm or lookup-mac-algorithm <civodul>"(guile-gcrypt) Message Authentication Codes" mentions it but it needs to be expanded <brendyyn>civodul: Oh I just realised I'm an idiot. after the algorithm is provided, it'll probably be called <brendyyn>algorithm in the function, so you then just run (mac-size algorithm) ***ericst_ is now known as ericst
<str1ngs>sneek: later tell daviid. it seems for language bindings the glib functions/macros g_error g_warning won't work. same with g_log. it looks like g_log_variant should probably work though. does g-golf have enough GVariant support to call 'g-log-variant? if not it's okay this mostly just a request for comment. the documentation for 'g-log-variant. can be found here <dsmith-work>spk121: I think the guile executable is still using libtool instead. *civodul applies the (srfi srfi-171) patch