IRC channel logs
2023-02-13.log
back to list of logs
<KarlJoad>Does anyone have documentation or examples on how use the guile-sqlite3 library? I am finding it difficult to work with just the exported procedures. <old>Note that I would not recommend to do like I did. I found it very cumbersome to do it that way, but I was in a rush <old>Any way to determine the distribution in a portable way with guile? <old>There's uname but it does not say for example ubuntu/archlinux <KarlJoad>old: I believe the general-ish solution for determining distro is to read /etc/os-release. <KarlJoad>Thanks for the links. These will be super helpful! <old>oh awesome thanks for /etc/os-release! is that part of FHS? <old>Happy to help :-) Like I said, my usage of it is terrible. I'm sure you will find a better way of doing things :-p <KarlJoad>Even Guix provides it now, as it is a simple thing to have present which makes many things a lot easier to handle. <dadinn>i can see that syntax-locally-bound-identifiers is defined in (ice-9 psyntax) module, but some reason when I try to use-module it says that no code exists for it <dadinn>it seems the psyntax module was last edited in 2012, so I would assume my Guile 3.0.5 should haves it! <KarlJoad>cow_2001: Not exactly equivalent to (runtime), but similar in this exercise is (current-time). Rather than measuring the uptime of the system, it takes the time since UNIX epoch. If you need finer granularity, I believe you can use (times). See (guile) Time. <cow_2001>to be honest i don't quite understand what they are asking me to do <KarlJoad>Can doc-comments be added to macros like they can for procedures, e.g. (define-syntax macro-name "documentation" ...)? <lilyp>KarlJoad: at least in syntax-case they can <KarlJoad>lilyp: I'm using (define-syntax macro-name (syntax-rules ...)), if that changes things. <lilyp>that'd change my answer to "I don't know" <jpoiret>syntax-rules is just a macro that extends to syntax-case, so theoretically yes <dadinn>it says there should be a syntax-locally-bound-identifiers procedure <dadinn>any suggestions where to find it? <dadinn>I am thinking I would need it, because I am writing a syntax-case macro, and want to ensure that an identifier is defined in the lexical context of the expansion, else use some default values instead it. <dadinn>hmmm... thought there is no define-module of any (ice-9 psyntax) anywhere in this file, which might explain why I cannot load it! :/ <sneek>dthompson, you have 3 messages! <sneek>dthompson, old says: there's couple of things to get fix. First module resolving of type with (system foreign) means no composition of structure <sneek>dthompson, old says: then there's the referencing with bytevector with I don't like. <dthompson>the manual says that syntax-locally-bound-identifiers is available in (system syntax) <dadinn>dthompson: ah, thanks... didn't notice that piece of code! :'D <dthompson>I've never used anything in that module but I was poking around that section of the manual recently. good luck! <dthompson>old: whoa that looks pretty cool! does it borrow from guix's code? I saw someone point to that in the log <dthompson>I'd have to try it out to really understand but the point example looks good! <dthompson>something like this should really make its way into guile core <old>Nope. daviid did point to me the guix code, but I was unaware of it <dthompson>ah okay, they look a bit similar. probably a good thing! <mwette>are those structs or classes (add methods)? <old>Guix version is way better (I'm bad at syntax-case) <old>But I support nest type. I don't see Guix supporting that <old>mwette: What do you mean? <mwette>i see define-c-struct ... copy-point. Is copy-point data, C function, or schemem procedure? <old>yes. And you get a reference. For example (rectangle-point rect) will give you a srfi-9 record with a slice of the underlying bytevector of the rectangle <dthompson>old: that is awesome! bytevector slices are great. <old>Now I want to support pointer to structure and not just composition <old>Also right now you have to define <point> before using it in <rectangle> which make sens. But if I were able to make a two passes compilation that could change! <dthompson>I maaaay see some sources of unnecessary allocation in here but I'm not sure <old>But I think syntaxes have the same probleme in Scheme. Order is important <dthompson>fwiw I think it's fine that you have to define <point> before <rect> <dthompson>old: the record type only has a bv field, so every time it needs converting to a pointer via bytevector->pointer a new pointer object is allocated. <dthompson>if you're making lots of calls, the allocations add up. <old>hmm true I did not think of that <dthompson>I have some performance sensitive code where I cache the pointer in a record field <old>I could probably cache the pointer in a member instead <dthompson>no need to allocate the pointer until someone asks for it, either. <old>Having set in the CTOR ahead of time as its advtange <old>Doing if-statement in a hotpath can be costly <dthompson>maybe in this case it would be better to allocate it up front. <old>I think so. Memory is not that much sacred anymore. We can spare the 8 bytes :-) <dthompson>I have some code that only sometimes needs pointers. plenty of objects are created that will never need a pointer. <dthompson>so it slows things down to create the pointer for every object <old>I was thinking of adding some configuration to the macro <old>(defin-c-struct <type> (#:packed #:aligned cache-line)) stuff like that <old>maybe a (define-c-struct <type> (#:lazy)) could be it <dthompson>personally I don't have bottlenecks around lazily allocating pointers <dthompson>it might be better to just not cache if there isn't one way to settle it <old>it's good to give the possibility though. This way it's just a matter of flipping a f to a t to see the difference <mfiano>Hmm, what is the signum function called in guile?