IRC channel logs

2026-06-05.log

back to list of logs

<probie>Are the "catamorphisms" described in srfi-241 particularly useful in a strict language? They seem like a stack overflow waiting to happen on any scheme which can't grow its stack
<probie>I guess it's not too bad, since you can "opt-out" by matching an earlier pattern which doesn't recurse
<GNUtoo>Hi, why is "(eq? (car (car '(('a . 'b)))) 'a)" #f ?
<GNUtoo>Can I use symbols in dictionaries ?
<probie>GNUtoo: because `''a` is not equal to `'a`. You probably don't want to explicitly quote `a` and `b`
<GNUtoo>Do you have an example?
<GNUtoo>Ah I got it: (eq? (car (car '((a . b)))) 'a)
<GNUtoo>Thanks a lot
<wehlutyk>dthompso`, just thanks for yesterday! Basic performance pretty much fixed https://gitlab.com/wehlutyk/eadt/-/blob/paper-no-class/tryouts/image-exploration.scm?ref_type=heads
<old>so let say I am adding some cool REPL history functionnality
<old>similar to Common Lisp
<old>* ** ** + ++ +++ / // //
<old>What should the name be?
<old>$* $** $** $+ $++ $++ $/ $// $///
<old>I guess that would be it ?
<JohnCowan>old: I prefer - to $, because not shifted (on the US keyboard); see https://github.com/johnwcowan/r7rs-work/blob/master/ReplCowan.md
<JohnCowan>see also the repl procedure there
<old>Hmm
<old>The thing is that we have already $N for history
<old>but it is true that's it is a pain to use the shift
<old>to be debate on the PR :-)
<old> https://codeberg.org/guile/guile/pulls/195
<old>Well I'm going ahead with the $* and friend for consistancy with the rest
<old>But until the release, we can still work on that
<optimal>the abuse i'm comitting right now with the metaobject system should put me in jail
<ieure>Good, good.
<optimal>although it's all to write the nicest web routing framework that Guile is desperately missing
<ieure>Gonna encapsulate yo ass in a computer jail
<optimal>ACTION has been encapsulated in a computer jail
<old>optimal: care to share what abuse?
<old>I've been using OOP meta object myself in BLUE and it's quite nice
<optimal>quite a lot actually
<optimal>i have a `stale' slot on the class that should be set to #t whenever certain slots have their value updated
<optimal>so i customized `compute-setter-method' to wrap the setter method procedure with one that will also set that stale property to true, if that slot has a #:makes-stale? true property
<optimal>similarly for slots that need to be updated when the object is stale, i customized `compute-getter-method' so that it checks every time a slot with `#:goes-stale? #t' is accessed to see if the object is stale; if it is, the procedure named by #:generator is called to provide a new value for the slot
<optimal>i also added a stale slot to the metaclass that gets set to #t when a method is added to any of my generics that includes that class as a specializer; i had to subclass <generic> and <accessor> for that one
<optimal>i'm gonna post the code soon, once i'm done polishing it
<optimal>the MOP is really nice, i've actually been able to remove a lot of macros just by using the MOP more and as a result also made the whole thing more customizable for subclasses
<optimal>all of this is just in an effort to make my little framework very REPL-friendly
<optimal>if i do everything right, you'll be able to start out with a tiny web app and then grow it to a giant one without ever restarting the router or leaving the REPL
<old>optimal: check this out if you are interested:
<old> https://codeberg.org/lapislazuli/blue/src/branch/main/blue/types.scm
<old>I prevent mutation (no setter) for any instance created from a class derived from <blue-class>
<old>also all getter will automatically force delayed expression. So your slot can be evaluated lazily when access
<old>and well the rest i just big sugar syntax over goops
<old>web: great! Do you plan on making a general purpose framework à la Django for the web?
<optimal>old: hopefully, the way i've done it, it should be extremely easy to add middleware just by using inheritance
<optimal>your router is just a class that subclasses <router> (well, it can just be an object of the <router> class but this is meant for much smaller applications), and so is middleware
<optimal>by customizing the generics and adding its own slots, middleware should be able to do pretty much anything, and there is a route context they can add stuff to
<optimal>i REALLY didn't wanna do stringly-typed routing so, each route actually uses a match clause and the handler is actually compiled at run time from those routes using Guile's `compile'
<old>nice
<old>can you capture the route argument in the match clause ?
<old>with predicate and such
<optimal>yes, but you will need to add it as an "argument"
<optimal>let me post a code example
<optimal> https://paste.debian.net/hidden/d650cdb3
<optimal>define-route has 3 arguments: router (object or class), match clause, and arguments passed, and the rest is the body
<optimal>the "arguments" are either variables from your match clause or parameters from the match context
<optimal>route context*
<old>cool!
<old>tho, if define-route is a syntax, could you not just accept GET instead of 'GET ?
<ieure>old, That'd probably break defining a route with the method in a variable.
<optimal>old: is there a template for BLUE for Guile Libraries? i'd love to publish this project using BLUE
<old>optimal: BLUE it written in itself
<old>so yes
<old> https://codeberg.org/lapislazuli/blue/src/branch/main/blueprint/buildables.scm
<optimal>will i have to copy-paste all of that to my repository?
<old>do you use guix ?
<old>we have a channel that you use to pull BLUE if needed
<optimal>i meant the buildables.scm file
<old>otherwise, only the blue directory and the boostrap script are required to be copy
<old>ahh
<old>not really. There's a lot in that file
<old> https://codeberg.org/lapislazuli/blue/src/commit/40ae4f5f1ec2536a0ede54636701688b8569b9bf/blueprint/buildables.scm#L122
<old>this definition
<old>is what you probably just need
<old>and also a blueprint: https://codeberg.org/lapislazuli/blue/src/branch/main/blueprint.scm
<optimal>excellent, thanks
<optimal>old: i checked out types.scm and it looks very very cool, i just have one question--why define instance-source-location, instance-source-origin and class-module as object properties? it seems to me that you could add a <blue-object> superclass to all BLUE classes that could just include those as slots
<old>you are right. But I don't want to take slot name
<old>from user
<old>that's the only reason I think
<old>Also there are not used often
<old>source location and origin are used for debugging purpose and origin tracibility. That is when printing an exception
<old>class-module is actually used more. It's necessary for serializing instances do disk (All BLUe instances can be serialize and read back)
<old>so I remove them from slot allocations, thinking it might favorise cache allocations of other slots
<old>(user slots are more compacted in memory)
<optimal>old: i'm not sure if it's intended behavior or a bug but slots seem to shadow each other, if you're inheriting from a class that defines some slot and you define a slot of the same name, they will coexist with the same name, and the accessors for each will work with the corresponding slot
<optimal>i don't know if it's intended behavior or not (i remember seeing a issue on the Guile bug tracker seeking to implement proper slot inheritance) though, so maybe not behavior to rely on
<optimal>the class serialization looks very cool though, i also remember there's some bitrotted code in (oop goops save) for the same purpose but it does a lot of string abuse and i'm not sure if it's refactorable lol
<optimal>as for the mutation of slot-set!, i remember there being <read-only-slot> and <protected-slot> slot classes, but they seem woefully undocumented
<optimal>i know that they were used in Guile-GNOME though
<ArneBab>old, mwette: I didn’t try strace yet -- I set the fibers parallelism to 1 in run-fibers.
<ArneBab>strace ends in:
<ArneBab>write(26, "\232\216wv\357\256\215\203/t\227g\261\266\361\317\4\0?\26\302;\370\320\f{c|\31N\347\215"..., 231) = -1 EAGAIN (Resource temporarily unavailable)
<ArneBab>poll([{fd=26, events=POLLOUT}], 1, -1
<ArneBab>just before a long list of writes, there’s
<ArneBab>poll([{fd=25, events=POLLIN}], 1, 0) = 0 (Timeout)
<ArneBab>epoll_wait(16, [], 8, 0) = 0
<ArneBab>When running via strace, every single run locks up. Otherwise about one in three locks up.
<ArneBab>What can I look for?
<mwette>If those came in same time I wonder if race condition. epoll man pages says the app can miss events if epoll is edge-triggered. Would need to look into the source.
<mwette>does fibers use epoll still or libevent?
<mwette>ah, epoll (linux) if available, otherwise libevent
<old>optimal: oh did not knew about read-only-slot hmm
<old>ArneBab: sorry what was the context again?
<mwette>I have no idea offhand right now.