IRC channel logs

2020-11-04.log

back to list of logs

<chrislck>AFAIU, CPS macro writers are voodoo practitioners
<leoprikler>Not sure, I think it's harder to write the macro without passing continuations
***apteryx is now known as Guest14481
***apteryx_ is now known as apteryx
<manumanumanu>leoprikler: If I got to chose between writing goof-loop using syntax-case and passing state using parameters and handling everything explicitly using syntax-rules, I would definitely use syntax-case. The reason I don't is to make it more portable. Using syntax-case and programmatically expanding the sequence macros I could actually write the sequence creators as procedures instead of the cluster-fudge it is
<manumanumanu>now.
<leoprikler>Is syntax-case not standardized?
<manumanumanu>in r6rs, yes
<manumanumanu>but programatically exanding macros is not.
<leoprikler>Ahh, so this is for r5rs compatibility.
<manumanumanu>and r7rs
<leoprikler>Oh, r7rs drops syntax-case?
<manumanumanu>no. the jury is still out on r7rs-large
<manumanumanu>but don't get your hopes up
<manumanumanu>I think the neatest thing if people are willing to break backwards compatibility would be srfi-72 (not sure about that number), which is sort of an amalgamation of syntax-case and explicit renaming
<manumanumanu>That more or less completely removes the need for gensym/generate-temporaries in syntax-case
<leoprikler>Hygienic macros?
<manumanumanu>syntax-case is hygienic unless you tell it not to be. The guarantee is just that any identifier introduced within a macro won't clash with any outside identifiers. That means if I have 2 (in-list identifier) macros that I expand programatically within my loop macro, their binding 'cursor' will collide
<leoprikler>I think you've misread me, the question was supposed to be "SRFI 72 Hygienic Macros"?
<manumanumanu>yes, that one
<manumanumanu>I had a look at guile's quasisyntax to see if I could maybe hack a way to add a (syntax-unquote/hygienic ...), but I never got far.
<manumanumanu>or a (quasisyntax/hygienic ...) where each unquoted syntax object is guaranteed to be unique.
<manumanumanu>but then psyntax.scm happened.
<manumanumanu>or rather, I don't really know to hack quasisyntax.scm. it seems manageable, but jeez...
<RhodiumToad>speaking of weird macros, I've been vaguely poking at trying to find a way around the r7rs letrec-syntax booboo
<RhodiumToad>(i.e. that letrec-syntax makes a lexical contour, so you can't use it at top level, as you can in guile currently)
<RhodiumToad>my somewhat vague thoughts were to do something that expands into a define-values
<RhodiumToad>(anyone have any thoughts on that?)
<manumanumanu>RhodiumToad: do you have more info on this booboo?
<manumanumanu>a discussion somewhere?
<RhodiumToad>uh, jcowan I think mentioned it to me here a while back
<manumanumanu>you can't use letrec-syntax at the toplevel? ...
<RhodiumToad>in guile you can.
<manumanumanu>I don't really understand where that is specified in the r7rs-small document
<manumanumanu>and it seems to work in my chibi install
<RhodiumToad>my understanding of r7rs, and jcowan's, is that it creates a lexical scope and therefore you can't put top-level (define)s in it
<manumanumanu>aaah
<RhodiumToad>let me find it in the logs
<RhodiumToad> http://logs.guix.gnu.org/guile/2020-04-08.log#195800
<manumanumanu>RhodiumToad: We need to figure out if any scheme actually does that. Chibi splices.
<manumanumanu>guile as well
***ftknox_ is now known as ftknox
<elliotpotts>evening folks
<elliotpotts>still haven't found any clue about catching errors during scm_read :(
<leoprikler>same is with other procedures,through scm_catch
<elliotpotts>huh, I guess
<leoprikler>*same as, of course
<dsmith-work>{appropriate time} Greetings, Guilers
<prussian_blue>welp, as somebody mentioned earlier
<prussian_blue>exception handling is implemented with setjmp, totally incompatible with c++
<prussian_blue>unless some wizard is familiar with the implementation... it could be possible to throw a c++ exception instead of doing a jmp
<dsmith-work>I suspect the only way is to always catch all C++ exceptions on the Scheme->C++ return boundary.
<dsmith-work>And probably the same if calling C++->Scheme.
<RhodiumToad>or use libunwind
*dsmith-work looks up libunwind..
<dsmith-work>Interesting
<RhodiumToad>luajit uses it on some platforms/compilers to make its exception handling interoperable with c++ exception
<dsmith-work>Doesn't newish Guile have non-contiguous Scheme call stacks?
<RhodiumToad>(a fact I recently became aware of due to having to track down a bug in same)
<RhodiumToad>the scheme call stack isn't on the C stack though.
<dsmith-work>Indeed
<jlicht>does anybody happen to have some guile snippets around to read and write YAML?
<leoprikler>There seems to be https://github.com/mwette/guile-libyaml
<jlicht>leoprikler: nice, that looks exactly like what I'm looking for
<leoprikler>The guix.scm sadly feels a little incomplete
<dustyweb>hi hi
<manumanumanu>ArneBab: goof-loop is now pretty much feature complete! No module definition yet, also no tests nor documentation, but done enough to play with.
<manumanumanu>ArneBab: goof-loop is now pretty much feature complete! No module definition yet, also no tests nor documentation, but done enough to play with.
<manumanumanu>ArneBab: https://git.sr.ht/~bjoli/goof-loop ... The code produced by the macros is nicer than guile-for-loops, and the iterator protocol is nicer. I believe I can actually implement something like (in-cycle (in-list '(1 2 3)) without much fuzz, using macro rewriting for the common cases, and srfi-158-style generators for the rest
<manumanumanu>anyway, good night!