IRC channel logs

2023-11-10.log

back to list of logs

<dsmith>apteryx, readelf -wl <some-file.go>
<rebiw>Is the following scheme syntax not valid in scheme??
<rebiw>(define-record-type <some-type> (fields (mutable a b c d)))
<rebiw>I meant in guile.
<haugh>rewbew it's (drt <some> (make-some a b c d) (a get-a set-a!) (b get-b set-b!) etc...)
<haugh>rebiw, that's the SRFI-9 record type available via (use-modules (srfi srfi-9))
<rebiw>yes I'm familiar with that syntax, I read the other syntax in a book and it seems way more convenient.
<haugh>Gotcha. I whiffed the predicate too, so maybe you have a point
<rebiw>I need to create a setter for each field using the guile syntax.
<KE0VVT>Does anybody use Haunt? My site has issues. https://codeberg.org/csh/personal-site
<rebiw>I have used it a little.
<haugh>rebiw, are you looing for the R6RS records? haven't used it myself but it looks cool: https://www.gnu.org/software/guile/manual/html_node/rnrs-records-syntactic.html
<rebiw>ah, define-record-type, maybe I will look into it.
<rebiw>Yes, that is the syntax that I was trying to use, thanks!!
<rebiw>Ke0vvt,what issue are you having with your site?
<rebiw>you have a temporary file with an extra ~
<rebiw>maybe the reader is having trouble with this file.
<KE0VVT>rebiw: That doesn't make a difference.
<rebiw>When using Haunt I use #:file-filter ignore-some-files-filter, to ignore some files,  css, etc.
<KE0VVT>rebiw: Where, in `(site)`?
<rebiw>Yes to the site function.
<rebiw>You have to create the filter.
<KE0VVT>rebiw: #:file-filter ignore-some-files-filter "*~" ;; Like this?
<rebiw>(define (ignore-some-files-filter post-filename)
<rebiw>      (not (string-match "\\.(scss|js|hbs|html)$" post-filename)))
<rebiw>You define the filter, then you specify it in the site function.
<apteryx>dsmith: I think I could make it work; but I'm not sure yet if it covers all potential cases
<apteryx>dsmith: ah, readelf -wl output is great
<apteryx>thanks
<apteryx>if you do: ./meta/guile -L test-suite -L . test-suite/tests/compiler.test do you see 3 FAIL, with exit status 0?
<apteryx>what's the deal here? are these real failures or not?
<apteryx>dsmith: I persevered a bit more and this appears to fix the issue: https://notabug.org/apteryx/guile/commit/d0c2d75df37c4894e4fa0576a38fb3d140fb8b6c
<apteryx>I made my parameter a fluid so that I could define it before the (primitive-load-path "ice-9/psyntax-pp") in boot-9.scm
<apteryx>all tests pass! cleaned up version: https://notabug.org/apteryx/guile/commit/52f036d51f094db847f0df4961906fb6f8b7ccca
<apteryx>sent patches against the original bug report
<apteryx>now I can get back to hacking adding SRFIs :-)
<isaneran>is there a way to declare a module in other contexts than the top level like for example in racket and chez?
<isaneran>like in a lambda for example
<wingo>isaneran: sadly no. would be nice!
<sneek>wingo, you have 1 message!
<sneek>wingo, dsmith says: flubt
<isaneran>wingo: yeah it would! I wonder if I can macro it in to make nanopass framework work on guile
<isaneran>I think maybe by using save module excursion plus some module reflection should enable some kind of module macro
<isaneran>but have to try it out
<isaneran>hmm guile seems to scream at me if I call module-export with a list of module variables, or a list of symbols or a list of pairs of symbols
<isaneran>sry module-export!
<RhodiumToad>how did you call it?
<isaneran>(module-export! m (list (cons 'foo v)))
<isaneran>(module-export! m (list (cons v 'foo)))
<isaneran>(module-export! m (list (cons 'foo 'foo)))
<isaneran>(module-export! m (list v))
<isaneran>v is a result of (module-variable)
<isaneran>m is a result of resolve-module
<RhodiumToad>I'm pretty sure it wants the names of the variables, not the values
<isaneran>ah sorry I have also tried
<isaneran>(module-export! m (list 'foo))
<RhodiumToad>and what happened?
<isaneran>In procedure struct-vtable: Wrong type argument in position 1 (expecting struct): #f
<RhodiumToad>you checked that the result of resolve-module was not #f ?
<isaneran>ice-9/boot-9.scm:1685:16: In procedure raise-exception:
<isaneran>yeah it is not #f
<isaneran>and it responds #t to module?
<isaneran>m is
<isaneran>#<directory (lmao) 7f3e4f955be0>
<isaneran>and (module-variable m 'foo) is #<variable 7f3e4894ec30 value: #<procedure 231fd98 at <unknown port>:67:46 (lol)>>
<isaneran>which is eq? v
<isaneran>so I am very confused
<isaneran>idk if it matters but, the context is a guile repl via geiser
<RhodiumToad>how did you create the module (lmao) ?
<RhodiumToad>(module-export! m (list 'foo)) works for me
<isaneran>I just used module-resolve to get it
<isaneran>can I create a module with reflection another way?
<isaneran>oh it's resolve-module, not module-resolve
<isaneran>either way, I used the one that exists :p
<RhodiumToad>ok, I can reproduce
<isaneran>do you think it is an incorrect way to create a module?
<RhodiumToad>the problem is that the created module has no public interface yet
<isaneran>hmm
<isaneran>yeah I do get #f if I call (module-public-interface m)
<RhodiumToad>you want to create a basically empty module to populate using module-* funcs?
<isaneran>yeah
<isaneran>so that I can implement a macro that works like (module ... ) in chez and other r6rs impls
<isaneran>or at least a good enough subset to port nanopass to guile
<isaneran>in a way that could fit upstream
<RhodiumToad>make-fresh-user-module might be what you're after?
<isaneran>oooh
<isaneran>how did you find this
<isaneran>either way thank you, I think I can work with that
<RhodiumToad>make-fresh-user-module is mentioned in the docs for define-language, but not anywhere else afaik
<RhodiumToad>the other way would be (define-module* ...)
<RhodiumToad>(which is the function that (define-module) expands to)
<isaneran>also not mentioned in the manual :(
<isaneran>but I guess source code is the best documentation
<RhodiumToad>ACTION is cheating by using the Source
<isaneran>that procedure seems to call beautify-user-module!
<isaneran>I wonder if that sets the public interface
<RhodiumToad>yes it does
<RhodiumToad>fun fact: the public interface is just another module object
<isaneran>haha
<isaneran>that is a bit surprising
<isaneran>since the type that gets printed in the repl is interface
<isaneran>instead of module
<RhodiumToad>yes, that's set by set-module-kind!
<isaneran>ahh
<isaneran>sneaky
<isaneran>hmm I guess define-module* doesn't necessarily make my life any easier since it doesn't allow me to inject code to initialize it
<isaneran>I probably need to handle the (define subforms to expand to module-define! somehow
<isaneran>are macros expanded from the inside out or from the outside in?
<RhodiumToad>outside in
<isaneran>lucky
<isaneran>would probably be screwed otherwise
<RhodiumToad>i.e. (foo (bar x)) where foo and bar are both macros will not expand bar unless it appears in the expansion of foo
<isaneran>you mean if foo searches for the bar pattern?
<RhodiumToad>no
<isaneran>ah wait
<isaneran>now I get what you mea
<isaneran>the expansion of foo could remove bar
<RhodiumToad>right
<isaneran>and then it wont expand
<RhodiumToad>or for example it could quote that part, in which case the literal '(bar x) would appear in the expansion
<RhodiumToad>rather than whatever bar would have expanded to
<isaneran>ah yeah
<isaneran>hmm ok my strategy might not really work
<isaneran>since the (module ..) code in nano pass contains macros that expand to define forms
<RhodiumToad>that might not be easy to handle in hygienic fashion
<isaneran>although that is the only macro helper it uses
<isaneran>I could maybe just reimplement that one to expand to the right thing
<isaneran>or maybe I can hack and call macroexpand or something haha
<isaneran>maybe it is enough to just expand to a (define-values (a b c) (lambda that returns the definitions with (values a b c)))
<isaneran>re
<isaneran>feel like search engines barely give any useful information anymore almost
<old>isaneran: try GPT you would be suprise how well it knows Guile
<isaneran>haha
<isaneran>yeah
<isaneran>though it also just makes shit up a lot of the time
<old>that's also true :-)
<old>Typically when an API change all the time, ChatGPT often generate code that worked with last version but not the current
<isaneran>any idea what #{} is in r6rss?
<old>fortunatelly, the Guile developers are no API breaker
<isaneran>well, most of the time anyway :P
<isaneran>lol
<isaneran>;;; unknown location: unexpected syntax in form ()
<isaneran>I don't think I know guile well enough to polyfill the guile compat stuff for nanopass framework
<isaneran>sad
<apteryx>what's the difference between guile-lib's shtml and sxml formats?
<apteryx>which one should I prefer for a conversion job (html->texinfo)
<apteryx>I'm guessing sxml, but I'd like to know how they differ exactly
<apteryx>hm, reading the source it seems shtml is a new improved addition over sxml... I guess I'll try using it first.
<isaneran>hmm I barely see any references to shtml in the manual
<isaneran>maybe it's just a layer on top of sxml
<apteryx>it's poorly documented
<isaneran>ahh so shtml is the (texinfo html) module
<isaneran>;;This module implements transformation from @code{stexi} to HTML. Note
<isaneran>;;that the output of @code{stexi->shtml} is actually SXML with the HTML
<isaneran>;;vocabulary. This means that the output can be further processed, and
<isaneran>;;that it must eventually be serialized by
<isaneran>apteryx:
<isaneran>(by sxml->xml)
<isaneran>so if you already have html, I am guessing by reading it in as an sxml it is already shtml by convention
<apteryx>hm, I don' think so, there is 'html->shtml' as well as 'html->sxml' procedures
<isaneran>where did you find the former?
<isaneran>well either of them actually
<isaneran>I don't see either of them in the default distrobution
<RhodiumToad>using sxml->xml will not produce valid html
<dsmith-work>Happy Friday, Guilers!!
<dsmith-work>sneek, botsnack
<sneek>:)
<dsmith-work>!uptime
<sneek>I've been faithfully serving for 2 days
<sneek>This system has been up 31 weeks, 6 days, 24 minutes
<dsmith-work>2 days?
<KE0VVT>In Haunt, how do I make blog post URIs in the form of /1970/01/01/title?
<KE0VVT> https://codeberg.org/csh/personal-site/issues/2
<apteryx>sneek: later tell isaneran see info '(guile-librey) htmlprag)', which mentions both html->shtml and html->sxml
<sneek>Will do.