IRC channel logs

2025-09-19.log

back to list of logs

<ArneBab>In my fibers using commandline tool I get this warning: WARNING: (enter): imported module (fibers) overrides core binding `sleep'
<ArneBab>Can I silence this somehow?
<ft>Maybe import fibers with a prefix symbol?
<rlb>Is fibers missing a #:replace (sleep) -- i.e. trying to recall if that fixes it at the source...
<rlb>Otherwise, yeah, perhaps a #:prefix or a #:select ((sleep . fiber-sleep) ...)
<old>I was thinking about this, but fibers does a copy of the dynamic-states for every fiber it creates right?
<old>does this involve lots of allocation? Like a copy is made for every fluids
<euouae>Hello
<euouae>I wrote my string rope library in Guile. I'm satisfied with it because IMHO it's better than the one from Chicken
<euouae>In the course of writing it I realized I wanted a property testing library like what haskell (& others) have
<euouae>I'm going to be looking into how all that works, SRFI-64, TAP protocol, etc. I want parallel tests, I want property testing, test case generation, etc
<euouae>did anyone wish for any of this before?
<euouae>oh huh, there's SRFI-252 for property testing
<euouae>hm... it looks like SRFI-64 does not (?) allow for parallel tests.
<euouae>I guess each test script is single-threaded but automake allows parallel execution of all those scripts
<rlb>right, via https://www.gnu.org/software/automake/manual/html_node/Parallel-Test-Harness.html
<euouae>it's dizzying how autotools make simple things become so complicated
<euouae>e.g. for whatever reason SCM_LOG_DRIVER_FLAGS doesn't seem to work for me from setting it in the shell
<rlb>Hmm, are you exporting it or putting it on the make command line, i.e. "make X=Y"?
<euouae>not that there's any useful flags that I want to pass but I was hoping to somehow select checks by name
<euouae>I did it with: env SCM_LOG_DRIVER_FLAGS='--color-tests=no' make -e check
<euouae>I think that's what's on the automake manual, the -e overrides from the environment
<euouae>It also advises setting AM_TESTSUITE_SUMMARY_HEADER but if I do that I get an error by automake that it cant be overriden
<rlb>I'm fairly certain you can also just say "make -j5 SCM_LOG_DRIVER_FLAGS=whatever, etc. if that's preferable somehow.
<euouae>I can't really get it to work
<euouae>--color-tests=no does not seem to turn off the colors
<euouae>perhaps something is wrong with it, who knows really. just tiresome stuff ;-P keeps you from concentrating on writing code
<rlb>That's probably because our driver is "limited" -- see test-suite/driver.
<rlb>I only implemented what we needed to get started.
<rlb>(to switch to parallel tests)
<euouae>I use this one <https://codeberg.org/annoyingusername/guile-project-skeletons-autotools/src/branch/main/recursive/apple/build-aux/test-driver.scm> and I don't think it's by you
<euouae>I picked it up from somewhere on github
<dsmith>Main bottleneck building from git is eval.go and psyntax-pp.go
<rlb>yeah, make clean hurts :)
<euouae>rlb: oh yeh you linked to a shell script, I havent' figured out the exact relationship between the sh script and the scm test runner. The sh script I use is provided from automake
<rlb>Ahh, I thought you were working with guile's automake stuff -- that has to provide an adapter for both the existing test-suite/guile-test harness and (more recently) srfi-64 based tests.
<rlb>nvm
<euouae>yeah unit testing in guile/scheme is messy
<ArneBab>rlb: I actually need fibers to replace sleep -- but fibers is no longer optional, so I can go for a renamer. Thank you! There is a replace in fibers/timers.scm, but not in fibers.scm which re-exports sleep.
<ArneBab>rlb: but when I add #:replace (fibers) in fibers.scm, it does not compile.
<ArneBab>rlb: https://codeberg.org/fibers/fibers/src/branch/master/fibers.scm#L34
<ArneBab>but I can use #:replace instead of #:re-export. Would that be correct then?
<ArneBab>rlb: I filed a PR in the hope that I’m right ☺ https://codeberg.org/fibers/fibers/pulls/142
<rlb>ArneBab: not sure I'm following completely, but there's also #:re-export-and-replace (sleep)
<rlb>if that helps
<cow_2001>`match' only matches on the first returned value
<cow_2001>could there be an extra syntax for more than one values?
<cow_2001>something like (match (values 1 2 3) ((~values a b c) (list a b c)))?
<cow_2001>iuno
<identity>cow_2001: you probably want to bind the values with let-values and then ‘match’ on them separately, or something like (call-with-values (lambda () (values 1 2 3)) (match-lambda …)). ‘match-values’ is possible, but Guile does not implement it as far as i am aware
<cow_2001>hmm
<ArneBab>rlb: thanks for #:re-export-and-replace - I switched to that.
<dsmith>sneek, botsnack
<sneek>:)
<dsmith>sneek, seen wingo
<sneek>I think I remember wingo in #guile 16 days ago, sayin': yes i would like t' look into that.
<wingo>o/
<dsmith>Arr
<dsmith>An alternative for testing seeking and holes on freebsd: https://bpa.st/OWPQ
<dsmith>OR should I say
<dsmith>An alterrrnative fer testin' seekin' and holes on frrrreebsd: https://bpa.st/OWPQ
<euouae>Hello, two questions: 1) can I have a string of static size (used as buffer) or do I have to use a vector? 2) are goops structs heavy (i.e. if I have 3 goops structs one within the other, is that three pointer indirection to access the members of the deepest struct?)
<dthompson>1) I suppose technically yes since string are mutable but I wouldn't use a string as a buffer
<dthompson>2) yes, three indirections.
<euouae>what would you use as a buffer? I want to save the keystrokes that the user types in an object
<euouae>a small gap buffer of size ~ 1KiB is what I was thinking of (for the processing) and eventually to be stored in a rope structure that I implemented
<euouae>Maybe a vector of chars is better
<ieure>A ring buffer is the usual structure used for a user's keyboard input.
<euouae>ACTION looks it up
<ieure>I wrote a ring buffer implementation for CL some years back, as an exercise.
<ieure>Ring buffer is why 90s PCs would beep in some cases if you typed fast, you'd fill the buffer with input before the computer could read it, it'd beep whenever the ring buffer was full (when the write pointer would advance to the read pointer's position).
<euouae>Oh yeah I see. I have also heard of the mmap trick
<euouae>I have not had a computer beep on me, I started using them in the 90s
<euouae>late late 90s
<euouae>but why circular? what is the benefit there? I don't get it
<euouae>if the user repositions the cursor with the arrow keys, I'd have some complex shifting to do
<euouae>ultimately I think I'd need a gap buffer (with maybe circularity for some marginal savings in worst case shifting)
<ieure>euouae, Circular because it's a single fixed-size buffer, which is very easy, vs. a gap buffer is two dynamic ones.
<ieure>euouae, I have no idea what you mean by arrow keys. You don't do any complex shifting with a ring buffer, you insert things and remove them, and update two pointers. Each cell is one character.
<euouae>ieure: You can write "Hello world|" where | is the cursor then move "Hello |world" and type "cruel " to get "Hello cruel |world"
<euouae>that's where the gap buffer mechanics come into play, initially the buffer is [Hello world|.........] then it becomes [Hello |.........world] and so on.
<euouae>you're thinking about where the keystrokes are stored before processing perhaps. I'm thinking of the internal representation of the text.
<ieure>Yes, totally different, my mistake. Ring buffer is what you want to get input from a device into the CPU, if you're editing text, you want a gap buffer or similar.
<ieure>"I want to save the keystrokes that the user types in an object" made me think this was the lower-level usecase.
<euouae>I think that circular buffer is maintaned by ncurses
<ieure>euouae, The kernel.
<euouae>Yeah I implemented a /rope/ but it does not seem enough, I think I still need a small gap buffer. I will probably use a vector of chars.
<euouae>ieure: hm? oh yeah that makes more sense. ncurses only has to request the characters from the pty
<ieure>Gap buffers are pretty easy to implement. I wrote one (in Python) at a previous job, for performing automated text editing for some infrastructure-as-code deploy stuff.
<euouae>Yeah but when I attempted to write one in C, 1) it was horrible and 2) it was not clear how it'd translate to Guile
<euouae>In particular there's no way for C buf memory to directly be used by a Guile string and vice versa
<euouae>plus unicode and the rest are horrendous to deal with C-side
<euouae>(at least, *I think* theres no way to share the memory in C and Guile for a string)
<euouae>What I'll do now is write it in pure Guile using a vector of char's
<ieure>Yeah, it would suck to implement in C, since the size of the buffers is always changing and you have to manage all that. I'd probably keep start/end pointers into each buffer and grow them as needed, then shrink rarely or not at all.
<euouae>You can use a static gap buffer if you also use a rope, which is what I plan to do
<euouae>Guile doesn't have resizable vectors I don't think
<euouae>I guess you could always allocate a new one of larger size and copy the data
<dthompson>yeah resizable vectors are pretty easy.
<dthompson>simple strategy is to just resize 1.5x when you hit capacity of the underlying vector
<euouae>why doesnt guile offer them though
<euouae>because they don't want to deal with allocation strategies?
<dthompson>I don't think there's any particular reason
<dthompson>besides not many people wanting it. I don't reach for a resizable vector very often.
<euouae>C++'s vector<> is probably its most popular data structure
<dthompson>yeah but in lisp it's different. lists cover most of the use cases.
<dthompson>I would be in favor of a dynamically sized vector in guile's stdlib, fwiw
<dthompson>I wrote one for chickadee, borrowing the name from java since "vector" is already taken in scheme: https://git.dthompson.us/chickadee/tree/chickadee/data/array-list.scm
<dthompson>nice to use as a stack with no upper bound on size.
<dthompson>I was afk during the ring buffer discussion, but I have an implementation of that, as well: https://codeberg.org/spritely/goblins/src/branch/main/goblins/utils/ring-buffer.scm
<euouae>There needs to be something under ice-9 with common data structures
<euouae>unfortunately then you get into the difference between SRFI-9 records and GOOPS records
<euouae>(or can GOOPS deal with SRFI-9 records?)
<dthompson>not sure where GOOPS fits into it
<euouae>inheritance
<dthompson>record types and classes are very different things.
<dthompson>you can't make a class that inherits from a record type.
<euouae>in what way are they different
<euouae>I was asking if they can be mixed and matched -- if you say no that's fine. But when you say different do you mean the Guile implementation or conceptually?
<dthompson>I guess I misunderstood your question
<dthompson>I thought you were referring to an object with a slot containing another object that contains yet another object within
<euouae>You're thinking of what I asked earlier with the 3 layers -- it was an example situation
<euouae>I'm just pointing out that it's frustrating that even if Guile were to offer some common data structurs under ice-9 there would still be the question of "do we use SRFI-9 or GOOPS?"
<dthompson>in that particular case, there would be no question: they would use records
<euouae>that's good, but why is that the way to go about it?
<dthompson>it's desirable to have a monomorphic interface for dealing with just that data structure as opposed to generic methods.
<dthompson>it's also more efficient to access records
<euouae>I see, I think I made a mistake writing my rope implementation using GOOPS
<dthompson>I like GOOPS personally, though others don't, but I use it as a layer on top of more primitive things
<euouae>does SRFI-9 allow for ice-9 match ($ <whatever> ...) ?
<dthompson>yes
<euouae>but how do you match on <string>? I thought that's pulled with (oops goops)
<ieure>dthompson, I haven't messed with GOOPS, how does it compare to CLOS?
<ieure>I like CLOS a great deal.
<dthompson>any string? like this (match "foo" ((? string? x) x))
<euouae>there's actually a comparison/critique online from dthompson on goops
<euouae>Ah nice -- you can use ? ... I didn't know that
<euouae>Or at least didn't think of it!
<dthompson>yeah the ? syntax allows for calling any predicate you want
<dthompson>ieure: https://dthompson.us/posts/issues-with-object-oriented-programming-in-guile.html
<ieure>dthompson, Amazing, thank you!
<dthompson>tl;dr - GOOPS is pretty good but missing some CLOS features I'd like to have
<dthompson>I'm not a MOP wizard though so I don't really know how to add the missing things
<euouae>kind of a lost art nowadays
<dthompson>GOOPS is still nice to have when you have a problem that is best expressed with OOP.
<dthompson>I've done some game engineish experiments where GOOPS worked quite well.
<ieure>I also don't have my head around the MOP, but I do have a copy of AMOP which I've read most of.
<euouae>really? wow!
<ieure>Don't use it enough to develop that bone-deep proficiency.
<dthompson>it's in my stack of books but I haven't read very much
<euouae>have any of you dealt with randomized unit tests?
<euouae>I tried to print *random-state* in the test-begin string with SRFI-64 but I could not replicate the results later
<euouae>doing (set! *random-state* (random-state-from-platform)) at the beginning of the test file
<ieure>I forget what I wanted to do, I think it was extend it to support my own specializers, so I could specialize on primitive types, or something like that. But you can't express that. I think there was an effort to extend the MOP to allow it, but I didn't pursue.
<ieure>Lost some interest after that.
<euouae>another limitation of MOP is that you can't ask for "only nonnegative integers" or something of that sort
<euouae>at least that's what I remember from decades ago, much later I learned that you need dependent types for that
<dsmith>So, today is "international talk like a pirate" day. I've got the bot wired up to pipe it's output though the "pirate" filter.
<dsmith>Not much bot action today though..
<dsmith>sneek, seen euouae
<sneek>I last saw euouae in #guile 4 hours and 55 minutes ago, sayin': at least that's what I remember from decades ago, much later I learned that ye need dependent types fer that.