IRC channel logs

2022-03-06.log

back to list of logs

***trip is now known as Guest6651
<charlieb>I'm getting a segfault under gdb with a minimal C guile invocation of scm_boot_guile.
<charlieb> https://gist.github.com/charlieb/a8cbcf6ee2daef2a366c41a19ff801b6
<charlieb>It's ok without gdb and valgrind seems ok with it
<charlieb>but it's going to make debugging a bit hard if I can't use gdb :)
<charlieb>I should say this is Arch and guile-2.2
<charlieb>I'm going to bed now but I'll check back in a number of hours for any tips or leads
<xelxebar>Are syntax-rules not first class?
<xelxebar>It's easy to create procedure wrappers like (if foo? do-foo do-bar), without needing a lambda wrapper.
<xelxebar>Actually, thinking more like this (let ((foo* (if has-foo? do-foo do-bar))) ...).
<xelxebar>Would like to do something similar when do-foo and do-bar are syntax-rules.
<xelxebar>But the only way I have found is by explicitly wrapping in a syntax-rules form, (let-syntax ((foo* (syntax-rules () ((foo* exp ...) (if has-foo? (do-foo exp ...) (do-bar exp ...)))))))
<xelxebar>But I really want to write (let-syntax ((foo* (if has-foo? do-foo -do-bar))) ...) just like with the procedure wrapper.
<maximed>xelxebar: Try defining (define do-foo (syntax-rules () ...)) (without the define-syntax) and likewise for do-bar. Then do-foo and do-bar are syntax transformers and not just macros, if I've got my terminology right, so you could do (let-syntax ((foo* (if ... (do-foo #'(do-foo exp exp* ...)) (do-bar #'(do-bar exp exp* ...))))) ...)
<maximed>You could also let foo* use syntax-case for more flexibility (usually, things like has-foo? need to be decided at expansion-time, not run-time)
<maximed>There's also some procedure for extracting the syntax transformer procedure from a macro (module-ref + macro-transformer)
<maximed>That's rather Guile-specific though, not portable to other Schemes.
<maximed>'scm_gettext' uses 'scm_to_locale_string', which can be problematic when the current locale does not have a sufficiently expressive character encoding (say, ISO-8859-1). Should it instead use scm_from_utf8_string and use bind_textdomain_codeset to tell gettext to produce UTF-8 strings?
<tohoyn>sneek: botsnack
<sneek>:)
<sneek>tohoyn: wb
<xelxebar>sneek: later tell maximed, Thanks for the pointers. You've at least given me some traction. Cheers.
<sneek>Got it.
<charlieb>oh well this is fun, I see the same segfault just running gdb $(which guile)
<charlieb>and the arch package is an orphan so no help coming from that quarter
<charlieb>sigh, exact same behaviour from a freshly compiled guile3
<ArneBab>cwebber: you need tsukundere/wisp
<ArneBab>cwebber: there’s a special package in the guix.scm of tsukundere
<rlb>For anyone interested, just pushed very preliminary support for protocols and records (clj data types) to lokke. As you might guess, they currently map more or less directly to generic functions and classes.
<rlb>(and need better everything, i.e. error handling/checking, etc.)
***alMalsamo is now known as lumberjack123