IRC channel logs

2019-11-25.log

back to list of logs

<seepel>Hi there Guilers, I'm looking for some guidance on how to setup/structure an application written in guile. I have only found this so far: https://www.erikedrosa.com/2017/10/29/guile-projects-with-autotools.html would this be the recommendation?
<seepel>I should probably also note that I am not very familiar with gnu build tooling
<daviid>seepel: yes, that link is a good sart
<daviid>then look at some 'living' project and of course you may ask for help here as well
<seepel>Do you know of any living project that creates an executable. The link I posted seems to be geared towards building a library, it is still a bit of a mental leap for me to figure out how to create an executable
<seepel>Or would I be looking to start with a c file that contains a main function that links to/and calls out to a guile library that would be my real application code?
<daviid>seepel: you can't create 'executables', but scripts, that are installed in $prefix/bin, no autocompile, short and that 'just' import your app compiled installed modules and starts or runs what ever it is you developpped ...
<daviid>seepel: no C code is better
<daviid>anyway, look at this link and pick a project you'd like to 'copy', it will take a certain amount of time/investment to learn about the autotool chain and how we use it for our guile projects ...
<seepel>Happy to invest the time as it seems like the investment will be worth it, but I'm really not sure where to start. Based on my question and your response I think I am even more confused than I originally thought :). By "this link" you mean the link I posted?
<daviid>yes I would strat by carefully read that and 'play' with a toy project while reading
<daviid>that link you osted ...
<daviid>*posted
<daviid>it misses a few things, for example the doc, a test suites ... but it's an excellent start
<daviid>then, as said, pick a 'real project' you like and read the autotool chain part of it
<daviid>what are you working on?
<seepel>I have lots of ideas, but primarily I want to get real life hands on experience with scheme, and Guile Scheme in particular seems to match my sensibilities. I was thinking I'd like to make an email client in GTK.
<seepel>Eventually I'd like to also get to the point of being able to hack on top of guile itself as well.
<daviid>great, maybe to start to learn scheme, and guile scheme, a 'none graphical' projet would be better, maybe ...
<seepel>Heh, that is probably good advice. The reason I wanted to choose this project is that in my previous job I built an email client for both iOS and desktop (using electron). So I know the architecture of the application really well, leaving the unknowns of the project being scheme and GTK.
<seepel>Over the last couple years I've made a conserted effort to learn scheme and I feel like I have a good idea of what's possible, but not a good intuition of the gotchyas. Of course I've mostly focused on learning scheme itself, so I'd like to tackle a project where the goal is to get something useable in scheme itself.
<seepel>I figure I'll start on the data layer using the gmail api/sqlite which would start acclimating me to thinking "scheme" before I had to go figure out how to think "GTK". And then if I don't lose interest go back and fill in IMAP and maybe have a nice little mail client.
<daviid>cool
<seepel>Oh, and WebkitGTK of course, course HTML email is all the rage :D
<daviid>ok, not my domain 'at all', but there are other guilers working in this area, for example someone here is developing a web browser, called nomad, usig webkitgtk, i think :)
<seepel>Oh, no kidding! That sounds awesome, is it this? https://github.com/mrosset/nomad
<daviid>yes, that one, the author is here in the channel very often, his nick is str1ngs
<seepel>Anyway, fingers crossed it seems like WebKitGTK does come with a WebView style widget that without diving too deep sounds like it will suffice for my purposes.
<seepel>Also, thanks for the friendly responses, working on getting the example repo from my link to compile now.
<daviid>seepel: welcome
<seepel>Thanks!
<seepel>Sorted out how to compile for 2.2, big struggle is that at one point I had compiled 2.9.4 from source and it was in my path before 2.2 so I tried modifying configure.ac for 3.0, but ended up getting errors like this: checking for Guile version >= 3.0... configure: error: Guile 3.0 required, but 2.9.4 found. Which seems to be coming from the fact that the effective-version for my self built guile was 3.0, but the actualy version was
<seepel>2.9.4.6-d1cf89. Is there a way to specify the beta in configure.ac?
<seepel>Totally separately make with the 2.9.5 sources segfaults for me, and I'm actually using WSL which doesn't actually save core dumps! So no idea on that one, but it happens on BOOTSTRAP GUILEC system/vm/linker.go
<daviid>savannah is down it appears, i can't pull/push
<daviid>seepel: if you could compile 2.9.4, it is suspicious (to me) that it would fail to compile 2.9.5, make sure you don't have 'strange' PATH settings maybe ... don't know
<daviid>in you project configure.ac? try with 2.9.4, or what ever is installed (but don't 'touch' the guile configure.ac)
<daviid>RhodiumToad: str1ngs: spk121: I finally got the source and closure 'problem' right, and users won't have to free these themselves when making call to g-idle-add, g-timeout-add and g-timeout-add-seconds, which is great (and a relief, I was unhappy with what I had till I found the right approach ...)
<str1ngs>daviid: great, that sounds more ideal
<daviid>unfortunayely, savannah is down, so i can't push the commits
<daviid>str1ngs: yes, this is much better for users of course
<daviid>can someone confirm savannah is down, just to make sure the problem is not on 'my side'
<str1ngs>seepel: https://github.com/mrosset/nomad is the project though github is just a backup to http://git.savannah.nongnu.org/cgit/nomad.git. but Savannah is down right now
<seepel>daviid: At least trying to visit the savannah web is not loading for me.
<daviid>seepel: ok tx
<seepel>As far as my project configure.ac specifying 2.9.4 fails to find guile at all as the .pc file was installed as guile-3.0.pc
<seepel>I'm going to have to sign off for bit, thanks for all your help, I'll come back to try to tackle this again at a later time.
<daviid>seepel: i don't have time to go to the details with you on this, i'm sorry
<daviid>ok
<seepel>No worries at all, very thankful for the help you did provide, I did manage to build something after all!
<daviid>congratulation!
<str1ngs>seepel: it's okay to use 3.0 with GUILE_PKG macro
<daviid>str1ngs: (and who's using g-golf), meanwhile (savannah down ...) here are two (3d valid) links to the two (g-golf) modules that fixes the source and (g-)closure 'problem' ...
<daviid>(g-golf hl-api closure) https://paste.debian.net/1117813/
<daviid>(g-golf hl-api glib) https://paste.debian.net/1117811/
<daviid>later, when savannah is back, you may checkout these two files to retrieve their respective uptream version ...
<zig>o/
<zig>why gettimeofday return a pair instead of a single integer?
<zig>there is slight issue with raise in scheme base: WARNING: (tests): imported module (scheme base) overrides core binding `raise'
<zig>i think (scheme base) should (re-export! raise) or something like that.
<lloda>I rebased my boot-9 exception format hack on top of current master
<lloda>as I didn't see how set-exception-printer! could be used to do the same thing
<lloda>:-/
<wingo>lloda: what's the issue?
<wingo>i wrote some code using exceptions the other days and found the default exception printer to be pretty nice!
<rekado_>spk121: the test passes when run in an environment that has an X server.
<rekado_>(the upgrade of the guile-gi package in Guix is only waiting for Savannah to come back up…)
<lloda>wingo: I need to fix the printer for every exception. Can I say (set-exception-printer! #t ...) ?
<lloda>only uses I see are in Guile itself
<wingo>lloda: did you consider installing your own exception handler?
<wingo>i imagine you did, wondering why that wasn't a good solution
<wingo>brb
<lloda>wingo: I didn't consider it tbh. How would I do that globally?
*chrislck has first positive experience with guix during nomad compilation... wow...
<lloda>something like (with-throw-handler #t (lambda () (run-repl (make-repl 'scheme))) (lambda (k . args) (pk 'IDID k) (apply throw k args))) ??
<lloda>I'm clueless :-|
<spk121>rekado: great. One test in main-loop.scm may randomly fail. It seems to be a GC race condition bug. I'm trying to track it down.
***cwaydt6 is now known as cwaydt
<wingo>lloda: ah with the repl it is more complicated. and call-with-error-handling needs updating to work more with exceptions than with key+args
<wingo>lloda: why do you need to fix the printer for every exception? just curious
<lloda>wingo: because the printers for standard exceptions like out-of-range or misc-error or anything really print untruncated objects
<wingo>lloda: ah so you want those printers to truncate arrays.
<wingo>i understand
<wingo>probably for that concrete problem we should change to make the printers truncate
<civodul>Hello Guilers 2.9! :-)
<wingo>:)
<civodul>wingo: i have Guix running on 2.9.5, with some remaining test failures
<wingo>nice!
<civodul>most have to do with mocking that sets global variables
*wingo wrote a script with fibers and the web client that does a HEAD over a list of paths, in parallel; seems to work with 2.9.5
<civodul>cool!
<civodul>also, all the dependencies of Guix are now packaged as 'guile3.0-*'
<civodul>that went fine, most of the time without changes
<civodul>in terms of performance, it seems there's very roughly 10% improvement on "guix build libreoffice -nd"
<civodul>sometimes less, depending on the exact workload
<civodul>but Guix does a lot of i/o and a lot of GC, so...
<str1ngs>daviid: looks like Savannah is back up
***mabgnu is now known as bandali
<zig>neat!
<wingo>civodul: neat :) probably could take another look too to see if there are hot spots that can be whittled down further
<civodul>yup
<civodul>i tried (statprof) but it seemed to always see 0.00 for the "self" timings
<civodul>which is weird
<civodul>s/see/say/
<zig>guile 2.9.5 is between 4% and 8% faster on my side.
<civodul>zig: faster than 2.2?
<civodul>on what kind of code?
<zig>faster than 2.9.4
<zig>that is mostly cffi, I guess.
<wingo>neat
<wingo>zig: do you use -O3 ?
<zig>no
<wingo>it doesn't match with all development workflows but if you need to squeeze out some speed it can be an interesting strategy
<civodul>i'm getting: In procedure raise-exception: Wrong type (expecting resumable continuation): #<vm-continuation 7f4b62b47610>
<civodul>i haven't managed to boil it down to a simple test, though
<wingo>civodul: for what?
<wingo>ah you are working on the "what" :)
<civodul>wingo: it's a simple srfi-34 raise with a srfi-35 &message
<wingo>i think that means when that continuation was captured, it had recursed through C
<wingo>ah. humm.
<wingo>yes.
<civodul>but srfi-34 raise is not continuable (right?), and there's no C stack in the middle i believe
<civodul>needs investigation...
<wingo>no, the situation is this:
<wingo>srfi-34 specifies that the handler for with-exception-handler runs within the continuation of the raise. not necessarily in tail position, but within that dynamic environment
<wingo>but, guard specifies that the guard predicates (the cond clauses) and the consequents run in the continuation of the guard.
<wingo>so if you have a guard, the exception handler installed by the guard should unwind the stack to the guard, run the clauses, and if non matches and if there's not an "else" clause, it should rewind (!!!!) the stack back to the exception to continue propagating the exception
<wingo>srfi-34 wasn't doing the rewinding before. i changed it to conform to the (stupid, IMO) spec
<wingo>but i used delimited continuations instead of full continuations
<wingo>because it's cheaper and nicer that way
<wingo>but it would seem that you are hitting a case in which delimited continuations don't work :/
<civodul>uh
<civodul>here's the C stack: https://paste.debian.net/1117854/
<civodul>would JIT code in the middle prevent rewinding?
<wingo>civodul: no
<wingo>jit does not prevent rewinding
<wingo>you won't see the interesting frame on the stack
<civodul>i always thought the guard clauses were running before unwinding had taken place
<wingo>because it was already unwound
<civodul>yeah
<wingo>civodul: see "git log" on srfi-34.scm
<wingo>if you want to try a fix, replace the "(rewind)" call on the last line with (raise-exception exn)
<zig>compared to 2.2.6, see guile 3 to be around 20% faster without -O3 https://paste.gnome.org/pfktukqde
*civodul checks https://srfi.schemers.org/srfi-34/srfi-34.html
<civodul>so in previous versions of Guile, the 'guard' clauses were evaluated before unwinding, right?
<civodul>contrary to what the spec says
*civodul would happily keep the non-conforming behavior :-)
<civodul>wingo: the C frame preventing rewinding is scm_force
<civodul>looks like promises could easily be moved to Scheme
<wingo>civodul: for me it is perfectly fine to keep our non-conforming behavior from before
<wingo>i have an alternate non-conforming behavior that might be interesting also
<wingo>it would be to evaluate the test clauses of the guard in the context of the error
<d4ryus>hi, why aren't fibers shipped with guile?
<wingo>and if any is true, we jump back to the guard, because we know that we won't need to rewind
<wingo>d4ryus: i was wondering that earlier today :) hard to know what to bundle with guile and what to let move forward on its own
<wingo>move forward or die on its own, even. if something gets in guile it never dies, which is good and bad :)
<d4ryus>i'd argue that doing anything with sockets in a blocking way is a bug, so there should be a way to do it right :)
<d4ryus>s/a way/a easy way/
***ng0_ is now known as ng0
<mwette>IIRC, fibers requires epoll, which does not exist on the macOS, FreeBSD, etc
<wingo>mwette: there is a patch to add support for kqueue
<wingo>i think aleix is going to merge it
<mwette>wingo: good deal
<civodul>wingo: re the 2nd non-conforming option, it sounds fine: the test clauses are supposedly pure, so it shouldn't matter whether they run before or after unwinding
<wingo>i argued for this behavior during r6rs standardization and didn't win
<civodul>i vote for either that or the old behavior :-)
<wingo>but now that standards are dead we can perhaps choose to break them :)
<civodul>ah ah :-)
*wingo trololol :)
<civodul>well we'd been breaking it for years without even noticing
<wingo>yes i found that interesting
<wingo>oh savannah is back, good
<bandali>git.sv is, sv itself not yet
<daviid>str1ngs: just pushed all pending fixes, + a new one (there was a missing call to g-source-set-closure in g-timeout-add, g-timeout-add-seconds, copy paste bug :) ... fixed)
<str1ngs>daviid: okay thanks
***jao is now known as Guest85731
<daviid>lloda: did you do this in a branch?
*daviid desperately need truncated print to be guile's default, for the repl and raised exception as well (as it is for the backtrace), for guile-cv users, then guile to provide a 'dead easy toggle mechanism' to switch from truncated print to full print 'on demand' ...
<daviid>*needs
<lloda>it's the same hack I had before, branch wip-exception-truncate
<lloda>daviid:
<lloda>I just had to redo it because of the recent changes in boot-9
<lloda>but I wanted to check out set-exception-printer! that was mentioned by civodul & wingo and confirm that wasn't enough for us
<lloda>unfortunately
<daviid>yes I know, thank you for this work, although only usable by avery very advanced users, like us ... - as you perfectly know, it is impossible for any user, sometimes not even advance hackers, to use guile to do anything with large data, wether lists, avectors, arrays ... it is just impossible, how terribly sad, several years i can't even have a single guile-cv user ... depressig to be honest
<lloda>we'll get there daviid
<daviid>lloda: yes, I'm confident as well, but I got my 'phases' of it would only take few minutes, if and only if, one of the maintainer installs guile-cv, then try 'something', they wll understand ... just a few minutes ...
<daviid>then they'd think they want tehir children to install and ue guile-cv to learn scheme and img proc ...
<daviid>good luck! :)
<daviid>and there is a guile-cv guix pckage somewhere, so it really would take literly less then a few minutes for them to try and see by themselves how unsuable guile is in dong anything with large data ...
<daviid>try to open any picture they tke with a phone .. just open an image ...
<daviid>then try (error img)
<daviid>to understand that the threee 'things' must be configured to truncate by default , the repl, the raised exception ystem and tye bracktrace (which does that by default, so why the backtrace and not the 'others' ... is a mistery to me)
<daviid>ok, back to hack g-golf