IRC channel logs

2023-01-22.log

back to list of logs

<KarlJoad>When I use SRFI-64 for unit testing, the test-driver script gets permission denied on the unit test.
<KarlJoad>./build-aux/test-driver: line 109: ./tests/article.scm: Permission denied
<KarlJoad>The actual code is at https://github.com/KarlJoad/gloa
<KarlJoad>I know this should pass because testing it in the REPL has both tests pass, so it is something with the build system.
<KarlJoad>I figured it out. It was the SCM_LOG_COMPILER variable in Makefile.am.
<haugh>(define-syntax m (λ(s) "docstring" (syntax-case s () ...)))
<haugh>Thoughts? Feels natural but I've never seen it.
<pottsy>Evening all. How do I allocate some memory and associate it with a scheme object? e.g. if I do `SCM my_val = scm_to_pointer(scm_gc_calloc(20));` in my function, can I be sure this memory won't be free'd before the end of the function?
<jpoiret>pottsy: hi, perhaps the memory blocks part of the documentation is relevant to your problem? https://www.gnu.org/software/guile/manual/html_node/Memory-Blocks.html
<jpoiret>you can use scm_remember_upto_here (documented at https://www.gnu.org/software/guile/manual/html_node/Garbage-Collection-Functions.html) to make sure something won't get gc'd until that point
<pottsy>jpoiret: thanks. I'm still getting the hang of this... I don't quite understand how all the memory stuff ties together
<pottsy>This page explains gc_remember_upto_here much better than the previous mentions of this function
<pottsy>But I also thought that the gc will scan the stack and therefore am not sure why a call to this is necessary
<pottsy>I'll reread the page about memory management for foreign objects
<old>pottsy: remember_upto_here generate a reference to the object in assembly that can't be optimized by the compiler
<old>Thus, it has to either keep the reference in a register or on the stack if it needs the register
<pottsy>ahh
<old>See libguile/gc.h:252
<pottsy>got it! thanks :)
<mfiano>ACTION decided he is getting burnt out writing guile `system*` shell scripts and is now taking the plunge into a huge ambitious guile project
<mwette> :popcorn:
<yarl>Hello guile. I am trying to use foreign-library-function with #:return-errno? but only one value is returned. http://paste.debian.net/1268133
<yarl>Am I doing something wrong?
<civodul>yarl: in 'let', you're binding only one value, so you're getting just that one value
<civodul>instead, you can use (srfi srfi-171) and write something like:
<civodul>(let ((ret errno (getsockopt ...))) whatever)
<mfiano>wasn't 171 transducers?
<civodul>ah wait, srfi-71?
<mfiano>ACTION thought he was keeping a good mental memory so far
<civodul>yes, that one
<mfiano>Ah ok :)
<yarl>civodul: Aw that's right I forgot... Thank you civodul.
<old>wait it's possible to have a `let' that can do that?
<old>I always use either `call-with-values', `receive' or `let-value'
<old>that is so nice
<civodul>srfi-71 is wonderful :-)
<mwette>Same w/ me: I didn't know about srfi-71. Thanks.
<mirai>is this sxml snippet equivalent to the XSLT included? https://paste.centos.org/view/7ee95b98
<mfiano>I wrote a `let` variant in CL that had the same syntax for multiple values. Curious if there is also a variant for `let*`. *reads*
<mwette>Is anyone using wayland (or westin)? I have a protocol-level guile program that will generate a icon on the dock but no window. The associated C program works OK. If you are interested in helping me debug it let me know.
<akirakyle>daviid: I think I may have found another g-golf bug. In the example I previously sent here: https://paste.sr.ht/~akyle/34263d3f72f0d4aa093976ab19c1215aef2fe7ad when guile's auto compilation is disabled (e.g. GUILE_AUTO_COMPILE=0) I get the error: In procedure primitive-call-ip: Wrong type argument in position 1 (expecting PRIMITIVE_P): #<procedure
<akirakyle>2daedd20 (_ _ _ _ _ _ _)>
<mirai>how do I fix this invalid Qname error? https://paste.centos.org/view/0a9fc9ab
<mirai>I can read from xml to sxml but now I can't write it back
<KarlJoad>What is the proper way to have optional fields for an srfi-9 record-type?
<count3rmeasure>KarlJoad: so this is close to what I was asking the other day https://logs.guix.gnu.org/guile/2023-01-16.log#234105
<count3rmeasure>and I linked the response I got
<count3rmeasure>its technically a different way of asking the same thing, as I was trying to get the syntax correct to for an optional field in the constructor function
<count3rmeasure>also someone recommend r6rs records, which apparently has directly what you need
<mirai>ah, I see that https://debbugs.gnu.org/cgi/bugreport.cgi?bug=20339 indicates this is a known issue
<count3rmeasure>there was an interesting bit in that long paper on "Hygenic Macro Technology" that came out last year I think, or maybe 2 years ago, on the history of record syntax, and r6rs records
<mfiano>count3rmeasure: Where would you recommend starting with Scheme macros? I only used CL macros for a couple decades where we control hygiene ourselves.
<count3rmeasure>mfiano: sadly I am not the person to ask on that, but I found that paper quite readable, and if you have that much experience with CL macros I imagine you'll find it easy reading indeed
<count3rmeasure>mfiano: here's a link to the paper itself https://dl.acm.org/doi/10.1145/3386330
<mfiano>I'm completely lost on syntax-case/syntax-rules/etc
<mfiano>But I have to start somewhere
<count3rmeasure>its a long read, over a hundred pages iirc, but again, for a seasoned lisper it should be easy reading
<mfiano>count3rmeasure: I wouldn't count on that :D
<mfiano>Every Scheme thing I read seems to result in me recursing down into a tree of concepts I'm unfamiliar with.
<count3rmeasure>maybe a good question to ask would be source to read that heavily relies on scheme macros and pair that with the reading, but again thats a question better left to others, I'm still quite new to guile and my practical experience with scheme is quite small and parochial
<mfiano>That's ok, thanks.
<mfiano>I'm currently reading r7 small. I seem to get the most out of formal technical documents.
<mfiano>I grew very tired and didn't get much out of TSPL4
<mfiano>I read the Guile manual twice in the last year, and have been toying around with that. I don't really know much about the standardized language that is Scheme [rNrs]
<count3rmeasure>I've found the manual great once I started doing real work with the language, much like gnu documentation generally. The vast majority of it seems to me to be written to be referenced, rather than read, even though I too have done that
<mfiano>I found the Guile manual to be rather excellent. I read things top to bottom usually before I dive in...makes it easier to learn as I reference it later. I'm a slow learner though :)
<count3rmeasure>same
<count3rmeasure>also dyslexic, which can make for difficulty in syntax heavy languages, partially why I enjoy lisp :)
<mfiano>:)
<mwette>mfiano: try Sec 3.1 and Chap 8 of tspl4: https://www.scheme.com/tspl4/