IRC channel logs

2026-04-13.log

back to list of logs

<JohnCowan>imo keywords are just syntactic sugar (or salt) for a plist.
<rlb>Anyone know of anything in gnulib like memmem, but for utf8? I didn't see it, and unfortunately (again) libunistring's only provides null terminated versions (e.g. strstr-ish).
<rlb>Hmm, or does memmem work fine with utf-8 just like memcmp does. Need to ponder.
<jcowan>It certainly should, since UTF-8 has only one way to encode codepoints and is self-synchronizing.
<rlb>(that rings a bell...)
<rlb>right, I just realized I probably knew that :)
<rlb>thx
<rlb>Then assuming the platform memmem is decent, we're about to get a notable string-contains* upgrade :)
<rlb>(Very long standing comment in strings.c on the topic.)
<rlb>(OK, utf8 branch now has a lot less scm_c_string_ref in srfi-13, and a memmem based string-contains.)
<probie>How can I intentionally make an unhygenic macro?
<probie>nvm, I have once again answered my own question (in this case, use `define-macro`, not `define-syntax`)
<identity>probie: or use syntax-case, which is a different can of worms
<old>probie: find a bug in psyntax :p
<mwette>in syntax-case, create a variable using datum->syntax
<dsmith>(Looks like #:keywords added in release 1.2 from 1997)
<mwette>dsmith: good hunting
<dsmith>Was in the NEWS file
<mwette>ah
<jcowan>Here's the partial list of Schemes with keywords from SRFI 88 (2006): Bigloo, Chicken, EdScheme, Gambit, Gauche, Guile, Jade (an implementation of DSSSL), Kawa, MzScheme, STKlos, and Sizzle
<jcowan>and here are the various syntaxes in use: https://docs.scheme.org/surveys/keyword-syntax/
<jcowan>(basically :foo, foo:, or #:foo, only the last being RnRS-conforming.
<mwette>Which n in RnRS introduced hash-extend?
<dsmith>I personally think the trailing colon style is visually nicer to read. "thing: value"
<mwette>I used to think that way but got over it. IIRC that form is used in smalltalk.
<identity>'(key1: value1 key2: value2)
<identity>then we just need to add comma-as-whitespace and we are most of the way to Python, err, Clojure
<dsmith>Yeah, I got over it too.
<ieure>Comma as whitespace is very good.
<JohnCowan>lisp 1 was suppistedto use commas, but there wwas a bug
<yarl>r6rs is not available in texinfo?
<lechner>Hi, how may I see the actual procedure arguments (rather than the placeholder _) in a backtrace, please?
<rlb>(I got used to :foo via clj, and it *is* easier to type, as often as you use keywords there.)
<rlb>I also toyed with using clj-style in some of the lokke modules at first, but stopped (if nothing else) as soon as I realized that the reader change is global, and so has to be manually reset before any loads, sub use-modules, etc.
<lechner>rlb / thanks!
<lechner>old / Hi, how does this work, please? "Tricks for debugging macros by quoting every cases in it"
<rlb>lechner: hmm, for what?
<mwette>you wrap your (syntax-rules) replacment forms inside (quote <replacement> )
<jcowan>I (re)invented that trick
<jcowan>or maybe got it from someone else, I forget
<dsmith>While you are editing/debugging your own macro, it's a very low budget "trick". (just a single ' )
<dsmith>sneek, macros?
<sneek>macros is http://hipster.home.xs4all.nl/lib/scheme/gauche/define-syntax-primer.txt
<dsmith>It's in there ^^
<lechner>mwette / jcowan / dsmith / thanks, everyone! it just dawned on me that the 'case' was the syntax case. i'm such a dummy
<lechner>but where exactly does that quote go in my syntax-case where the template starts with #`, please?
<lechner>i have to delete my Guile object cache for the template changes to have an effect
<identity>know issue
<identity>known
<lechner>actually, my template issues are gone. they were the result of outdated object files
<lechner>identity / which issue exactly, please?
<identity>Guile does not track macro updates, as the module containing the macro definition is not referenced in the compiled code using the macro
<identity>it will be referenced if any other identifiers from the module defining the macro are used, though
<lechner>identity / okay, thanks! is there a short explanation as to why this is not happening the way one might expect? something about the relationship between the syntax expander and the compiler, perhaps?
<identity>when Guile loads a module, it loads all the modules referenced by the module (a module is referenced if any identifier from a module is used in the compiled code), and if any of the used modules (or, recursively, modules used by modules used), it re-compiles relevant modules. after all the macros are expanded, there is (usually) no references left to the module defining a macro, so Guile does not load the module co
<identity>ntaining the macro definition
<identity>basically, after expansions all macro uses are gone, so you do not know if the original code depends on a macro
<lechner>identity / okay, thanks! that'll help me circumnavigate the issue next time
<rlb>Completely eliminated string_ref from utf8 srfi-13.c. I'll push that update later. (Still a hand(s)ful in numbers.c and print.c (for example).)
<mwette>sweet
<rlb>...we should have (at least) scm_to_(u)intmax variants that set a value for range errors instead of throwing so that we can use them to provide better error messages when validating arguments. e.g. for substring start/end in all the relevant string/srfi-13/srfi-14 functions.
<rlb>Right now, you just get a generic range error, rather than "this arg is bad".
<rlb>Maybe I'll attempt that later...
<lechner>Hi, anybody have an example for 'make-pointer' with a finalizer? Is that supposed to be a one-argument Scheme function?
<ekaitz>lechner: let me search, because I think I have one
<ekaitz> https://github.com/ekaitz-zarraga/guile-libnotify/blob/master/notify/glib.scm#L112-L120
<ekaitz>ACTION now realizes that he has to move that to codeberg
<ekaitz>lechner: so yes, one arg procedure it seems
<lechner>ekaitz / thanks! by the way, this is a non-judgmental space as far as I'm concerned
<lechner>i wonder why I can't use a Guile procedure
<ekaitz>lechner: what?
<ekaitz>oh maybe it's not a guile procedure but a pointer!
<ekaitz>let's read the docs
<ekaitz>lechner: Return a foreign pointer object pointing to address. If finalizer is passed, it should be a pointer to a one-argument C function that will be called when the pointer object becomes unreachable.
<ekaitz>that's (make-pointer ...)
<old>it has to be a C function because it goes out of scope of the GC I think
<old>at the same time, we have Scheme finalizer for other things ..
<ekaitz>if you want to use a guile procedure as a finalizer you should use make-foreign-object-type
<old>so not sure why this required
<old>you could just also do: procedure->pointer and use that
<old>just keep the pointer alive globally or else ..
<lechner>ekaitz / old / okay, thanks!
<old>wrt to macro and module, guile also does not track change in inlined expressions across module
<old>At O2, Guile can inline public bindings in module A used in module B
<old>think of public getter of a record for example
<old>Changing A, won't trigger a recompile of B
<old>At higher optimization level, private bindings can also be inline I think
<old>not sure how to attack this problem, but one solution I can think of is
<old>each module that is compiled, will store a build-id of itself along with a list of build-id of other modules that it used.
<old>when loading B, we first need to load A. The build-id of the module A is store along with it. Then after completely load B, we need to scan the list of build-id used by that module and compare against loaded module
<old>if any mismatch is found, the result of loading B must be discard and auto-compilation must be done
<old>At least that's my first intuition
<old>In other words, we are kind of taking a snapshot of the module tree when compiling and compare it later at load time