IRC channel logs


back to list of logs

<civodul>sneek: later tell vagrantc there's a new Guile-Avahi 0.4.1 release, with build system improvements :-)
<sneek>Will do.
<old>done with the bindings of libev. Starting a higher level interface
<mwette>old: great; using ffi or C?
<old>pure ffi
<old>had to read the entire include file though. Lot's of macro stuff in it ..
<old>Like clever but not great for an ABI kind of C macros
<mwette>I hate that. glib is the worst. Know about the nyacc ffi-helper?
<mwette>It does not convert macros, but can help with structs and functions.
<mwette>(It does simple define macros, but not function macros.)
<mwette>I'm working on protocol-level wayland client in guile:
<mwette>er, it's gobject that is the worst wrt cramming stuff into C function macros and using non-std C (like statement expresssions)
<daviid>mwette: but (i know you know, but for those who follow and do not know ...) GLib/GObject is a full (dynamic type) oop language, is has nearly nothing to do with C, except it is implementned in C ... so, to your own 'defense', ffi-helper is to help guilers making bindings for C libs, not gobject, nor any gobject based libs - users who want that should use g-golf - imo :)
<mwette>daviid: agreed: glib and co have become my std test case for working C parser.
<old>I know that nyacc is something related to C compiler. Can it parse header file and auto-generate some bindings?
<old>I've been doing it by hand for all my projects :-/
<old>And libev has a lot of function macro. They try to be clever also by doing memory aliasing. Really the worst
<old>nyacc is suprising good
<old>I do get an exception though so I can't finish the auto-generation
<mwette>old: report a bug:
<lilyp>mirai looks alright for your first peg, though you might want to consider whether it's a strict or loose match to the grammar you have
<flatwhatson><a12l> Not sure what you meant with "TCO means that "extra" iteration to hit the natural termination is free", but it feels that it's important when rewriting the function?
<flatwhatson>a12l: i just mean it's better to factor things so it terminates by returning result, instead of duplicating the cons call
<alextee[m]>is there any chance of windows support anytime soon?
<alextee[m]>im considering using something else for application scripting
<jpoiret>is windows not supported? I thought it was
<drakonis>work gotta be done to make it happen
<yarl>Hello guile.
<yarl>If I run `(waitpid WAIT_ANY WNOHANG)` I got "ice-9/boot-9.scm:1685:16: In procedure raise-exception:
<yarl>In procedure waitpid: No child processes". How do I catch this exception? I tried`(with-exception-handler (lambda (e) (display "error")) (waitpid WAIT_ANY WNOHANG))` But it does not work.
<civodul>yarl: hi! (catch 'system-error (lambda () (waitpid ...)) (lambda args ...))
<yarl>Thank you civodul. with-exception-handler is not usable here?
<civodul>ACTION checks
<civodul>it is, like so: (with-exception-handler (lambda (e) (pk 'x e)) (lambda () (waitpid WAIT_ANY WNOHANG)) #:unwind? #t)
<civodul>you forgot to wrap the waitpid call in a thunk above
<yarl>Hmm. Ok I'll re-read "6.11.8 Exceptions" :)
<civodul>wingo: hi! did you have a chance to look at the assembler/linker changes i proposed?
<civodul>i'm planning to merge them soon and publish 3.0.9rc1 afterwards
<civodul>mwette: i think mmap will be for the next round...
<lloda>i hope we can have fixed before 3.0.9
<civodul>ACTION looks
<civodul>hmm i'm still getting "In procedure frame-local-ref: Argument 2 out of range: 0" while display backtraces
<lilyp>sneek later tell mirai re "generalized sgml parser" my only worry was whether it'd also parse quoted input where no quoted input should be expected and vice versa or whether the structure is actually that loose
<flatwhatson>civodul: do you have a way to trigger it? maybe it's a different code path, i only fixed what i could reproduce
<mwette>civodul: no rush on mmap; I am also working on sendmsg/recvmsg, fyi
<lloda>i remember checking flatwhatson's fix at the time and it did work for the cases i could look at
<civodul>flatwhatson: i tried (compile '(make-vector)), then hit C-c and ,bt
<lloda>confirm hmm
<flatwhatson>ok yeah that's a different frame-local-ref call!
<mfiano>Curious, how much knowledge of the C code or VM bytecode does one need to hack on the low level Scheme code parts of the compiler? How friendly is it to someone well-versed in compiler theory, but is scared of C? ;)
<civodul>flatwhatson: aaah, see? ;-)
<civodul>mfiano: good news: the compiler is 100% Scheme :-)
<civodul>the VM is 100% C though
<mfiano>That is good news, but there's a difference between all-sceheme in some compressed DSL IR form one must have intimate knowledge of to hack on, and...ya know, regular code :)
<mfiano>I hope to contribute sometime when I'm more comfortable working with Guile. 20 years of exclusive CL use will rot ones' brain.
<mirai>lilyp: does it not handle quoted input?
<sneek>Welcome back mirai, you have 1 message!
<sneek>mirai, lilyp says: re "generalized sgml parser" my only worry was whether it'd also parse quoted input where no quoted input should be expected and vice versa or whether the structure is actually that loose
<lilyp>it does, but you don't seem to differentiate between quoted/unquoted input based on location in the file
<flatwhatson>civodul: so somehow that frame has frame-num-locals => 0
<flatwhatson>so i guess the good news is the same fix will work on that path
<mirai>Are the quoted and unquoted rules insufficient?
<mfiano>Thanks. I have yet to read most of andy's excellent articles
<mirai>or a counterexample might be easier
<lilyp>these two cases look the same to your peg
<mwette>I love to read them. Was reading just yesterday.
<flatwhatson>civodul: this workaround works for me:
<flatwhatson>not sure how to make a reproducer for that particular one though!
<flatwhatson>actually that can be (< 0 nlocals), it's already in scope
<mfiano>Great, looks like I'm subscribed to the list with civodul's response coming through.
<mirai>lilyp: right, the second field can't be unquoted
<civodul>flatwhatson: looks reasonable; do you think you could come up with a test for this one? :-)
<drakonis>ah... i remembered something nice about scheme...
<drakonis>lexical scoping is consistent
<drakonis>i can invoke define inside another function and now it will lexically scope it
<drakonis>instead of having inconsistent scoping semantics
<mirai>lilyp: I presume an unquoted second field is propagated to id as the entire remainder of the line, which causes `S path' to not match
<mirai>so the `line' ends up matching the ignore rule
<lilyp>I'm not sure about that, the path I took back when I wrote this was through another rule that would have parsed this "correctly" but with the above caveat.
<mirai>tbh this is all a one-time thing to retrieve some fields from the docbook catalog (though I found out there's that covers more about the syntax)
<flatwhatson>civodul: actually this is a better workaround, it actually completes the backtrace:
<mirai>fun exercise but a lax parser should be enough for this purpose (to patch some docbook guix packages)
<flatwhatson>first one just failed a moment later in (application-arguments) which assumes non-zero nlocals
<civodul>ah good
<flatwhatson>In language/tree-il.scm:
<flatwhatson> 435:3 4 (foldts #<tree-il (call (primitive make-vector))> _)
<flatwhatson> 435:3 3 (foldts #<tree-il (primitive make-vector)> _)
<flatwhatson>looks more promising :)
<flatwhatson>i'm not sure about reproducing that Ctrl-C directly in a test...
<flatwhatson>maybe possible to have a simpler test which creates a frame with zero locals and ensures it can be printed
<flatwhatson>but i have no idea how to make frames like that right now :)
<flatwhatson>will have a closer look tomorrow
<civodul>right, we'd need the test to somehow create a stack with a 0-nlocals frame i guess
<civodul>thanks for taking a look!
<count3rmeasure>is there a simply incantation that tells guile to find a module in the current working directory while hacking with the interpreter? I'm not using geiser at the moment, just doing basic stuff but I'm hitting "no code for (mymod mod) when I call it from the interpreter
<count3rmeasure>*simple incantation
<flatwhatson>count3rmeasure: something like (add-to-load-path (getcwd)) ?
<count3rmeasure>flatwhatson: tried that in the interpreter, no dice, would I include that in the module file itself? (and thank you)
<flatwhatson>count3rmeasure: it works, it adds the current working directory to load-path
<flatwhatson>if it's not working for you, maybe current working directory isn't what you expect?
<flatwhatson>check (getcwd) return value.
<count3rmeasure>yeah I did that
<count3rmeasure>its the same directory
<flatwhatson>so you have (define-module (foo bar baz)) in foo/bar/baz.scm from the current directory?
<count3rmeasure>but this is the right thing to figure out, I just need to find out why this isn't doing what its supposed to
<count3rmeasure>it was the module name, I had started the modules file name with a different one then what I was attempting to call
<flatwhatson>the module and filename must correspond
<count3rmeasure>yes, I just discovered that :)
<count3rmeasure>thank you for walking me through it, I appreciate it
<flatwhatson>it comes up pretty frequently, which is surprising considering every language i can think of works this way
<count3rmeasure>yeah, a little embarrassing! its still not working for some reason, but this was a vital fact that I needed to learn anyway, quite literally on my list of things to test today
<flatwhatson>maybe guile needs a better error message when a module can't be found
<count3rmeasure>this is the code and the interpreter session; code: session:
<count3rmeasure>if you can see any egregious mistakes proceed with the tomato throwing
<count3rmeasure>I'm using "scripts", since thats the directory this file is in, to denote the modules location in the define-module pair, maybe I need to add the full path information?
<old>count3rmeasure: Guile's module must reflect the filesystem from one of the load paths
<old>Assuming you have `/home/projects/test` in %load-path. And a module `(foo bar)' in a file `foor/bar.scm' under the `test/` directory
<old>In a project there's typically a `pre-inst-env' script that set the load path of Guile so that the REPL, and any scripts, can load the modules
<count3rmeasure>old: so, firing up an interpreter in the directory of the location of the module, and running (add-to-load-path (getcwd)) should work though, right?
<count3rmeasure>thank you for the for the note about `pre-inst-env' script, I'll dig on that too
<old>Yes. Assuming that under the current working directory there's a hiearchy that reflect the module
<old>when you do a `(use-modules (foo bar))' there must be a file `foo/bar.*' under on the %load-path
<old>I think that the %load-path is search in order
<old>So adding the current working directory in the front is probably what you want
<old>s/under on/under one/
<count3rmeasure>that was it!
<count3rmeasure>I moved up a directory and repeated the process and it found the module
<mwette>count3rmeasure: (add-to-load-path (getcwd)) is not it?
<count3rmeasure>no it works, just not specifically in the directory where the module is located, I had to move up a single directory and it found the module at that point
<old>Can someone show me their configuration of geiser for Emacs?
<old>This is maybe a emacs question more than guile ..
<old>I use `use-package' to ensure geiser and put `(setq geiser-repl-per-project-p t)' under the `:init' keyword
<old>Does not seem to work :/
<count3rmeasure>old: definitely interested in this as well, I asked in the geiser channel about a problem I had but I didn't (and still don't) have time to dive on why it wasn't working
<count3rmeasure>they were quite helpful fwiw
<count3rmeasure>friendly and quick to answer
<count3rmeasure>so, if I define a top-level record, the first function within that record definition, the "make-my-record" function should have global scope to the module, right? such that by using that module I'll be able to call the (define jones (make-spacecadet field1 field2 fieldN)) in the interpreter and just have it work? Because I'm hitting a wall right now where it can't find this creation function
<mwette>count3rmeasure: I usually generate an file somewhere to set up GUILE_LOAD_PATH and source that.
<lloda>count3rmeasure: you need to export those functions no matter how you define them
<count3rmeasure>mwette: thats cool! thank you for that. this is a different question though, its found the module and is compiling and recompiling it on load but I'm having trouble in the interpreter with my record-creation function being found
<count3rmeasure>lloda: thank you
<old>oh well turns out use-package is crap sometime. Got it right by simply using `(require 'geiser)' and setqing the variables
<old>I think it would be great to have a small configuration example of Emacs for Guile in the manual though. The information is a little too sparse on the internet
<chrislck>in srfi-64 -- I'm not sure if I'm reading it right; does (test-error [[test-name] error-type] test-expr) read to anyone else that error-type must match the (error error-type) call?
<chrislck>(afk for 7h)
<old>test-error excepts an error of type `error-type'. You could put any condition type you've defined with define-exception-type
<old>However, there's a bug in the implementation of Guile IIRC. It does not work.
<old>at least that's the experience I had
<mirai>is this expected?
<mirai>I've copied the example from the manual
<mirai>(only changed #t to #f)
<mirai>it looks like it counts the arguments but doesn't take in account that they're nested
<old>Is there a way to get the last value in the REPL?
<old>Like python has `_'
<old>Something without the $N
<mwette>old: seems to be local to save-value-history in (ice-9 history)
<lilyp>It's not: (hash-map->list cons (module-obarray (resolve-module '(value-history))))
<apteryx>can I delay a macro in Guile, or is there no point?
<apteryx>such as (delay (match (...)))
<apteryx>ACTION guesses there's no point, but still curious
<lilyp>you can delay the evaluation, but not the expansion
<lilyp>try (delay match)
<apteryx>I see. So it's still be useful to save run time when not needed
<apteryx>the compilation time would be unchanged
<lilyp>could also be useful if you can still encounter runtime faults that you want to guard against
<lilyp>e.g. (delay (match (something-that-gets-resolved-later) ((...))))
<lilyp>don't forget the handy c++ trick of instrumenting your constructors
<apteryx>OK; i'll keep this in mind, thank you!
<old>What tricks are you referring to lilyp?
<count3rmeasure>style question: I've got a list of strings with a 6 item semi-regularity where sometimes the sixth string is missing, a null value, I'm trying to chop up the list and I'm curious what yall would suggest. The list is generated by munging a table where the six items represent rows with some rows having null values
<count3rmeasure>as of now I'm using iteration, a do loop with a cond form, and I haven't decided on how to check for the null values yet
<count3rmeasure>I'm thinking I could use a closure to keep track of state between iterations and make decisions based on the previous value(s)
<mwette>If "loop" means named-let I usually track state using extra variables in the named let form. But context is not totally clear.
<count3rmeasure>on a different note, is there a syntax for optional arguments to srfi-9 record make-record* creation functions?
<rekado>count3rmeasure: for structural values I like to use (ice-9 match); that way you can destructure your list and match on individual fields
<count3rmeasure>rekado: is that a reply to my previous query, about how to make decisions over a list with semi-regularity?
<count3rmeasure>and also thank you rekado
<flatwhatson>count3rmeasure: srfi-9 has no special constructor syntax, it's common to name the generated constructor %make-thing and write your own make-thing wrapping it up
<count3rmeasure>flatwhatson:thank you, I was getting syntax errors trying to add a lambda* with an optional arg to the %make-thing definition inside of the record definition
<sneek>Welcome back dsmith
<dsmith>sneek, botsnack
<sneek>dsmith, you have 1 message!
<sneek>dsmith, rekado says: same bug as before; it fails to reliably close teh old port and open a new file.
<dsmith>old, Here is my emacs/geiser config
<dsmith>(use-package geiser
<dsmith> :ensure t
<dsmith> :custom
<dsmith> (geiser-mode-start-repl-p t)
<dsmith> (geiser-active-implementations '(guile))
<dsmith> (geiser-default-implementation 'guile))