IRC channel logs

2021-05-01.log

back to list of logs

<wklew>does anyone know if there's a fix for cond-expand not expanding correctly inside define-library?
<wklew> https://www.mail-archive.com/bug-guile@gnu.org/msg10146.html
<wklew>I meant to ask if there's plans to release a fix, a patch was posted in the thread but I haven't tried rebuilding guile
<wklew>with it applied
***sneek_ is now known as sneek
<leoprikler>linas: I'm sure cogserver has a purpose, I just wanted to point you to something else so that you don't need to rely on it "just to have a REPL server".
<rekado>linas: I don’t understand the “telnet” comment. You don’t need to use telnet to talk to a REPL server.
<rekado>if you have a test case to demonstrate “crashy” we would be very interested in reproducing the problem.
<lampilelo>how to get a terminal width in guile when COLUMNS env var is not set?
***zap1 is now known as zzappie
<manumanumanu>zzappie: regarding your question: you are trying to display the syntax transformer from the match macro?
***jonsger1 is now known as jonsger
<zzappie>manumanumanu: hello! No actually It was a WAT moment when I was working with g-expressions and guix's shepherd services. Service I wrote was crashing. So I tried to find out whats going on there and noticed some spooky action
<zzappie>match was a syntax transformer
<zzappie>I could understand how it would possibly happen
<zzappie>*coudn't
<zzappie>same thing wihth response-code from (web response) module
<zzappie>I could't look code coumpiled by gexps (if its the right wording) because in this particular case I had to deal with .go files
<zzappie>I posted It here and not in #guix cause I though someone could have a clue ho such thing could happen in guile or maybe already had such experience
<zzappie>I eventually solved the problem by removing with-imported-modules form and using shepherd-service record's "modules" field.
<zzappie>but what happend remais a mystery to me
<zzappie>In short: no, I wanted to understand how (pk match) would possibly output (<#syntax transformer>) rather than throwing syntax error :)
<RhodiumToad>why would it be a syntax error?
<zzappie>RhodiumToad: I don't know the answer. But it was my experience with any macro
<zzappie>try running: guile -c "(begin (use-modules (ice-9 match)) (pk match))"
<RhodiumToad>yeah
*zzappie thought: shouldt here be a guile bot that evaluates expressions?
***jonsger1 is now known as jonsger
<zzappie>sneek: eval (+ 2 2) pls
<leoprikler>zzappie: (module-ref (resolve-module '(ice-9 match)) 'match), you're welcome
<zzappie>leoprikler: ((module-ref (resolve-module '(ice-9 match)) 'match) ...) is not the same as (match ...) right?
<leoprikler>there's probably a subtle difference
<zzappie>in case of ((module-ref (resolve-module '(ice-9 match)) 'match) (() 'nill) (_ 'rest)) it will try to evaluate subforms (is this the right word?) and yell at me because of ()
*zzappie meant ((module-ref (resolve-module '(ice-9 match)) 'match) '() (() 'nil) (_ 'rest))
<leoprikler>yeah, I thought so, because module-ref doesn't actually bind it as syntax
<zzappie>I guess it's a bug then
<RhodiumToad>module-ref is giving you the value bound to the symbol
<RhodiumToad>(which for a macro is a syntax transformer object)
<zzappie>I for some time thought that syntax if first class in scheme
<RhodiumToad>which is not the same thing as actually importing the macro into the current scope
<RhodiumToad>consider that macros have to be known at compile time
<zzappie>RhodiumToad: yeah: I meant its not guile bug, but guix bug
<manumanumanu>zzappie: match _is_ a syntax transformer. When used normally you sholdn't see it, but when you are doing macrobatics you can get that kind of thing.
<manumanumanu>guix g-expressions is probably level 5 macrobatics.
<manumanumanu>I don't know. I only go up to level 4, and only when intoxicated.
<zzappie>manumanumanu: haha
<manumanumanu>zzappie: did you ever see "peak syntax rules" by tailor Campbell? It is the syntactic parameters used by his foof loop implementation. The loop facility is rather WTF, but the syn params part is insane...
<manumanumanu>Taylor?
<manumanumanu>yes. Taylor R. Campbell. Amazing stuff.
<manumanumanu>zzappie: http://mumble.net/~campbell/tmp/foof-loop.scm
<zzappie>manumanumanu: wow.. I think Im not ready for that just yet :) But I'm adding it to my scheme stuff list
***Server sets mode: +nt
<avp_>Hello Guilers. Guile-SMC (Guile State Machine Compiler) version 0.1.0 is out: https://lists.gnu.org/archive/html/guile-user/2021-05/msg00000.html
<wingo>neat!
<avp_>I think one could implement C code generation from the Guile-SMC internal transition table in the future using this: https://github.com/zenhack/c-ast
<rlb>Say I need a data structure available during expansion/compilation that is consulted by, and adjusted by the compilation process, and I also need some of the info that was collected to be available at runtime. Is there a typical way to handle that?
<rlb>I think I know some ways to handle it, but didn't know if there was a common/preferable approach.
<leoprikler>rlb: syntax-case, just make sure you write whatever data you need into the runtime code
<leoprikler>it's probably a good idea to filter it
<mwette>nyacc has a routine `pretty-print-c99' that takes C AST in SXML and generates C code. It is fairly mature. And you can use parse-c99 to generate SXML ASTs from C code.
<rlb>The issue is that I need to accumulate info over multiple macro calls (calls which consult the accumulating info), and then have some of that info also be available at runtime. One approach perhaps, is to manipulate/consult the "global" data structure from the syntax expanders, and then also have the expansions include code to populate the relevant structure at runtime.
<avp_>Oh my. Thanks, mwette!
<rgherdt>hi all! Could some Guile maintainer please take a look at following bug (with solution) and possibly apply the changes? It would make R7RS's define-library work
<rgherdt> https://debbugs.gnu.org/cgi/bugreport.cgi?bug=40252
<avp_>Currently I'm more interested in producing FSMs for Scheme world though, but in the future nyacc may come in handy.
<mwette>I hack on FSMs also, and keep it in Scheme, for the win. Have fun!
<nckx>Hullo #guilees! Minor quibble: the reversed line numbers add unnecessary surprise: https://paste.debian.net/plainh/0199a8db
<nckx>But it's such a Schemey thing that it made me laugh so kudos for that.
<daviid>rlb: what about (eval-when (expand load eval) ...)?
<civodul>nckx: i think i got used to it! "reverse packtrace notation" it's called
<rlb>daviid: right, I assume I'll be using eval-when variants as part of the process.
*civodul notes that nckx has a bunch of non-literal format strings at hand
<nckx>civodul: Don't we all? They're (info (G_ "~x")) calls.
<civodul>nckx: yes, we all do :-)
<civodul>i'm used to seeing that warning and it's perfectly legitimate in this case
<nckx>Sure.
<civodul>we'd need a way to annotate the thing so the compiler looks at the string inside
<civodul>or we could express it slightly differently
<nckx>That's what I was (extremely idly) poking around at when I got distracted by the reverse packtrace notation. 😉
<civodul>no big deal though
<civodul>heh :-)
<nckx>I gather there's no existing annotation system?
<nckx>Then I see why everyone just gets used to the warnings.
<civodul>yeah
<mwette>What is bad about having non-literal format strings? I get that for C, but for Scheme type values are known at run-time.
<mwette>s/type values/value types/
<wingo>mwette: often is a bug, consider (lambda (x) (format "~a" x))
<wingo>also prevents checking that arguments conform to format string (-Wformat)
<civodul>in C it can be tragic; in Scheme it's a bad-looking run-time error
<mwette>I'd assume when format string is processed for say ~d you can check arg via (integer? arg).
<wingo>rgherdt: applied, tx for poke!
<sneek>Welcome back wingo, you have 1 message!
<sneek>wingo, civodul says: thanks for the super fast bug fixes!
<wingo>sneek: late tell stis tx for report, fixed :)
<sneek>stis, wingo says: tx for report, fixed :)
<wingo>ah you are here :)
<wingo>daviid: also fixed the (lambda ( . args) ...) thing, was a bug in the new read-syntax
<wingo>sneek: late tell stis tx for report, fixed :)
<rgherdt>wingo: awesome, many thanks
<sneek>stis, wingo says: tx for report, fixed :)
<wingo>weird, stis is not actually here afaics?
<wingo>odd behavior
<wingo>sneek: later tell stis tx for report, fixed :)
<sneek>Got it.
<wingo>ah just a typo on my side then
<RhodiumToad>wingo: did you get the mini-gmp thing?
<wingo>ah no not yet, tx for reminder
*wingo looks
<RhodiumToad> https://dpaste.org/kvZP
<RhodiumToad>without that it fails to compile if HAVE_CONFIG_H is defined
<wingo>RhodiumToad: i just tried the tarball and it just works here if i --enable-mini-gmp
<wingo>what could be the difference in our systems?
<RhodiumToad>HAVE_CONFIG_H
<wingo>you explicitly define HAVE_CONFIG_H in your cflags?
<RhodiumToad>no
<RhodiumToad>I'm on freebsd, presumably configure is setting it
*civodul built it with --enable-mini-gmp in Guix too
<civodul>wingo: i got around to fixing the -Wunbound-variable issue at https://issues.guix.gnu.org/47031
<RhodiumToad>another possible difference is whether it's using the lib/unistd.h rather than the system one
<daviid>wingo: hello. did you read the feeback i posted here, wrt the fix for #47084, with a debian paste (that expired now ... i can posted again, answer #47084, or opening a 'new' bug report ... that was the feedback and following quiz ...
<wingo>daviid: sorry all i got out of it was the (lambda ( . args) ...) issue
<wingo>if there is another problem please let me know
<RhodiumToad>the error is #error "Please include config.h first."
<civodul>RhodiumToad: the change you pasted above makes sense to me
<civodul>otherwise there could be mismatches
<wingo>RhodiumToad: yeah i don't doubt that such a clause might be needed but i didn't know why it worked here
<civodul>like you include Gnulib's <assert.h>, but it thinks <config.h> is needed
<RhodiumToad>every other file has that conditional block in it, it's just missing from mini-gmp
<wingo>ok great will add that then
<civodul>could be that on GNU/Linux we don't use much of Gnulib's header, so it doesn't make any difference
<RhodiumToad>does the lib/ stuff even get used on linux?
<civodul>some of it, but not much i guess
<wingo>RhodiumToad: fixed
<wingo>civodul: great! (re -Wunbound-variable issue)
<RhodiumToad>LGTM
<daviid>wingo: yes there is another problem: the fix fixes the example, the mdule (a) that is in #47084 - however, it doesn't fix dynamic expected functionality of module-use! - that is if the public interface of a module that has been module-used! evolve 'in time', those who module-use! don't see the new bindings, unlike 2.2 - let me paste again, in a few min, i need to reconstruct the paste (which expired)
*wingo zzz
<daviid>ok, good night
<daviid>wingo: if you catch this before to go to bed, so you dream about a solution :):) - https://paste.debian.net/1195962/ - this feeback depends on g-golf, but i'll build an example/snipset that doesn't and answer in #47084 - good night again