IRC channel logs

2021-04-29.log

back to list of logs

<poww0wmus1c>Can you have output parameters in Guile/Lisp?
<RhodiumToad>no
<RhodiumToad>assuming I understand what you meant correctly
<poww0wmus1c>Like: (define (foo x y) ...) and I want to set x or y from within foo.
<RhodiumToad>you can mutate the things that were passed as x and y, if they are mutable (many things aren't), but you can't change what the caller's variables refer to
<OrangeShark>You can with srfi box
<RhodiumToad>the caller can pass a box, yes
<daviid>i think guile has parameters, iirc :), guile-cv uses them]
<OrangeShark>see srfi-111 for box
<RhodiumToad>basically, if the caller does (let ((x 123)) (foo x) x) the result will always be 123, assuming foo is a function and not a macro
<RhodiumToad>unless I'm badly misunderstanding something
<daviid>make-parameter, parameterize ...
<RhodiumToad>poww0wmus1c: so the real question is why do you want to do this?
<poww0wmus1c>I have an exception handler to which I'm passing variables that I want to reset to a good state.
<poww0wmus1c>I guess box could work
<RhodiumToad>that sounds like those variables maybe ought to be parameters?
<RhodiumToad>are they local?
<lampilelo>can't you redesign to use dynamic-wind or something?
<poww0wmus1c>RhodiumToad: practically, yeah
<RhodiumToad>parameters (and the fluids they are based on) are automatically reset on exceptions or other nonlocal control transfers
<poww0wmus1c>lampilelo: maybe, I'm not familiar with dynamic-wind. :)
<RhodiumToad>parameters are simpler
<poww0wmus1c>RhodiumToad: what if I need a more involved reset? Like one of the variables is an SDL window. I want to recreate it.
<RhodiumToad>confirmed that --enable-mini-gmp is broken - minigmp.c is missing its include of <config.h>
<RhodiumToad>poww0wmus1c: wouldn't you usually define the exception handler inline such that it has access to the variables anyway?
<poww0wmus1c>I'm a very unusual programmer :P
<poww0wmus1c>But yes, maybe I'm solving the wrong problem here. I'm not sure these need to be parameters.
<RhodiumToad>sneek: botsnack
<sneek>:)
<RhodiumToad>sneek: later tell wingo, build fails with --enable-mini-gmp due to missing include <config.h> in mini-gmp.c
<sneek>Got it.
***V is now known as based
***based is now known as V
***leoprikler_ is now known as leoprikler
<daviid>i just did git pull - which implies to merge the local patch of ice-9 boot-9 - then the autogen/configure/make/install danse, then guile version tells me 3.0.5.173-5b4a9 - i was expecting 3.0.6.xxx, did i kiss a step or 'something'
<daviid>*miss a step (sorry i miss typed k instead of m ...)
<daviid>the installed version has the ix duplicates handlers for interfaces that use interfaces patch though so i guess i am ok to try
<daviid>hum, i had a strange error report compiling g-golf, the (g-golg hl-api function) module, so i decided to clone a fresh master, run the autotool danse, installed, and checked the version is now correct, then did a clean and fresh attempt to compile g-golf, but it raises the same strange error, which paste
<daviid>wingo: after a fresh clone, attempt to compile g-golf raises an exception, but the report is so strange that i can't figure out what causes the exception in the first place - here is a paste, including the last bit of the configure step, so you see it picks guile-3.0, then compile a fair amount of the g-golf project, nearly to the end actually, but fails with this 'strange' error msg trying to compile (g-golf hl-api function) module -
<daviid> https://paste.debian.net/1195617/
<wingo>daviid: fwiw there is an issue regarding syntax-error which civodul found overnight
<sneek>wingo, you have 1 message!
<sneek>wingo, RhodiumToad says: build fails with --enable-mini-gmp due to missing include <config.h> in mini-gmp.c
<wingo>might have to re-roll a 3.0.7
<daviid>ah ok
<daviid>i have to go to bed, it's been a very long day ... be baack tomorow ...
<daviid>tx
<wingo>civodul: re syntax-error, probably something that should make us roll a 3.0.7 soon
<wingo>wdyt
<manumanumanu>I am seeing no problems with 3.0.6. No slowdowns for compilation. One 50% speedup out of the blue, probably due to the compilation unit arity check thingie :)
<civodul>wingo: the fact that syntax-error exceptions show vectors instead of alists?
<sneek>civodul, you have 1 message!
<sneek>civodul, bone-baboon says: Thank you. Your questions and strace suggestion where enough to help me solve the error with reconfiguring. It was user error on my part. A typo in a file path that `with-input-from-file` was looking for.
<wingo>civodul: yeah
<civodul>yes, could be
<civodul>i wasn't sure if it was intended
<wingo>is an unintended change certainly
<civodul>for the record, here are the changes i needed to make: https://git.savannah.gnu.org/cgit/guix.git/commit/?id=524c9800afb433cc474132185d8e37f72004adb3
<civodul>for syntax-error + read-error
<civodul>also: https://issues.guix.gnu.org/48089
<civodul>but yeah, the syntax-error change is user-visible
<wingo>if you send me some failing unit tests, i can fix the bugs :)
<civodul>alright! :-)
<vbramselaar>Hi there, would it be possible to run something like https://orgmode.org/worg/dev/org-element-api.html in guile without Emacs? for parsing org files?
<vbramselaar>I saw that guile has some elisp support
<zzappie>vbramselaar: From my experience org-mode code is very dependent on emacs envifonment
<vbramselaar>yhea it seems like it, does guile not translate things like: (current-buffer) or (set-buffer)?
<zzappie>vbramselaar: never tried it. But that would be cool
<manumanumanu>vbramselaar: the thing is, a lot of emacs is written in C. Even a lot of elisp functions. The work that was done on elisp was done with a clear intention of running guile together with emacs, and a lot of the functionality is simply not there when running it standalone
<manumanumanu>I remember trying to get this across to some guy who wrote the "guile elisp sucks" post that was making rounds a year ago or so.
<vbramselaar>manumanumanu: Yhea I understand it now. I was mostly looking around for possibilities for running elisp without Emacs.
<vbramselaar>like when you want to make a different application and parse org files
<vbramselaar>could write a parser yourself or use org-element
<zzappie>vbramselaar: I once stumbled upon org-mode parser in guile
<zzappie>I tried to look for it now but cannot find it. It was on github
<manumanumanu>What guile-emacs would have become (and it probably wont) would have been cool. Imagine having all the elisp runtime outside of emacs! The utilities one could write for org files, yet have it work exactly like emacs :D
<vbramselaar>zzappie: Thanks anyway for looking around
<vbramselaar>manumanumanu: yhea true, there a couple of other libraries for parsing org-mode, but would be nice to stay as close as possible to the creators of the org-mode standard ofcource.
<zzappie>emacs -Q --script do-things-with-org.el # is probably the best at the moment
<vbramselaar>but hey this is also a option: https://orgmode.org/tools.html
<vbramselaar>zzappie: yhea true, tbh I wanted to have a parser for on android to experiment with
<vbramselaar>zzappie: getting emacs on there seems hard
<zzappie>oh ah i see :)
<vbramselaar>but anyway thanks for the help guys
<zzappie>vbramselaar: i don't see any links in the topic but I think this channel encourages people to address people in gender neutral ways (people/guilers/yall/etc...). Just letting you know :)
<flatwhatson>vbramselaar: This is some recent discussion about an org grammar: https://lists.gnu.org/archive/html/emacs-orgmode/2021-04/msg00382.html
<flatwhatson>which references this: https://github.com/tgbugs/laundry
<civodul>oh nice
<civodul>we should steal it :-)
<civodul>wingo's Guile-Present has an Org parser, but maybe it's more limited
<wingo>it's reallllly old and prolly buggy
<civodul>heh
<leoprikler>w.r.t. Guile Elisp, I can understand that not all functions are implemented, but missing language features is ehhhhhhh
<civodul>take it as an invitation to fill the gaps :-)
<wingo>:)
<wingo>there was a branch that still needed to be merged, right?
<wingo>perhaps terpri will remember
<leoprikler>btw. did 45131 make it into 3.0.6?
<wingo>leoprikler: no but it should make 3.0.7 :)
***rekado_ is now known as rekado
<rekado>wingo: this one perhaps: https://git.elephly.net/?p=software/guile.git;a=shortlog;h=refs/heads/wip-elisp
<rekado>it’s the rebased wip-elisp branch
<rekado>it’s also far behind, but less so than the original wip-elisp branch :)
<stis>sneek: where is bugs
<stis>sneek: botsnack
<sneek>:)
<stis>sneek: where is debugs
<tohoyn>sneek: botsnack
<sneek>:)
<dsmith>Hey
<dsmith>sneek: bugs?
<sneek>I could be wrong, but bugs is Send reports to bug-guile@gnu.org, and see bug reports at https://bugs.gnu.org/guile
<dsmith>About the difference between emacs-lisp the language and emacs the application:
<dsmith>Consider javascript. Nodejs doesn't have all the functions and features that are in a browser, right? Like dom stuff?
<dsmith>I don't do js (much), so maybe I'm wrong.
<abcdw>Can I post to this channel?
<abcdw>Oh, seems, it works again)
<abcdw>Is there a way to get values of environment variables exported by a shell script? Something like source or . command in Bash. Something like (source-env "./bashrc")
<dsmith>abcdw: Are you asking can Guile parse and read shell syntax?
<abcdw>dsmith: yep, kind of. Or maybe run external shell process and read variables that it will export.
<dsmith>abcdw: Nope. not out-of-the-box anyway. If using an external process, the variables would only be in that other process (and child procs of it).
<zzappie>I think gash can do it. Or at leas it has --parse flag
<dsmith>Shell source and . must be in the current process.
<zzappie>it spits out sexpressions
<abcdw>zzappie: thank you for the idea!
<dsmith>zzappie: Ah cool
<zzappie>I didn't use it but I think its in (gash parser)
<flatwhatson>you could cobble something together to run your script, then run env, and parse that output
<flatwhatson>to be super fancy you could run env before and after to calculate the diff
<abcdw>flatwhatson: Yep, that's idea I got in my head, when I wrote a question, looks like a viable solution. Thank you.
<abcdw>Thank you everyone for help!
*zzappie finds himself exiting bash with ,q
<civodul>:-)
<lampilelo>lol
<brendyyn>i watch to match a value after a value in a lis but this says dotted tail is not allowed after ellipsis (match '(1 2 #:tests? bleh 3 4 5) [(a ... '#:tests? foo . z) foo]
<dsmith-work>Morning Greetings, Guilers
<davexunit>brendyyn: I don't think it's possible. you can't use a dotted tail after an ellipsis nor can you use multiple ellipsis patterns at the same level. using a loop and searching smaller and smaller lists would be my recommendation.
<zzappie>hey anyone knows is there a like (nested-ref '((a . (b . (c . hello!)))) 'a 'b 'c) ;; $1=hello!
<zzappie>already defined somewhere?
<zzappie>s/a like/something like/
<davexunit>zzappie: not in guile core, no. I've had to write my own a few times.
<zzappie>davexunit: ha. It must be reimplemented in many programs dealing with json then :)
<leoprikler>oh, there is something akin to that in sxml
<leoprikler>but it might not suit your needs otherwise
<leoprikler>That reminds me, perhaps I ought to consider sxml as data storage for Tsukundere, would be fun.
<leoprikler>rewriting scenes using pre-post-order
<zzappie>problem with sxml is that you only remember about sxml when you dealing with xmls
<leoprikler>yep
<zzappie>but there is a lot of useful general purpose stuf like foldt
<leoprikler>I wish sneek had a "tell me in six months or so" function.
<dsmith-work>heh
<leoprikler>sneek later ask ArneBab with the new licensing changes, is there a way of constructing a "wisp-minimal" package, that is effectively expat-licensed?
<sneek>Okay.
***leoprikler_ is now known as leoprikler
***Noisytoot is now known as \\
***\\ is now known as \r\n
***\r\n is now known as Noisytoot
<ArneBab>leoprikler: yes
<sneek>Welcome back ArneBab, you have 1 message!
<sneek>ArneBab, leoprikler says: with the new licensing changes, is there a way of constructing a "wisp-minimal" package, that is effectively expat-licensed?
<ArneBab>leoprikler: yes, I think it’s pretty easy to create a wisp that is expat licensed
<stis>hey wingo: did you see the compiler bug I found?
<wingo>heyoo
<leoprikler>ArneBab: Does wisp internally use invalidate-compilation-cache?
<davexunit>has anyone ever written a tree shaker for guile programs? until we get native executables, I'd like a way to create binary bundles that contain the minimal number of guile modules needed to run.
<leoprikler>Tree shaker?
<davexunit>leoprikler: "tree shaking is a dead code elimination technique" https://en.wikipedia.org/wiki/Tree_shaking
<leoprikler>Hmm, with guile being a reflective language, I think I can easily write code that shakes your tree shaker.
<davexunit>huh?
<leoprikler>shakes as in confused
<leoprikler>confuses
<davexunit>I'm not looking for a robust solution. simply booting the program and getting a list of all loaded modules will be sufficient.
<davexunit>I'm not sure if there's a public api for seeing all of the loaded modules, though.
<davexunit>haven't spotted one, yet.
<cybersyn>are native executeables on the guile roadmap?
<davexunit>yes.
<cybersyn>nice! that will be pretty sweet.
<davexunit>many enhancements over the years have been paving the way to eventually make it happen.
<leoprikler>ArneBab: please have a look at https://gitlab.com/leoprikler/tsukundere/-/tree/wisp-packaging from both a functional and a licensing side :)
<davexunit>JIT compilation is a big one
<leoprikler>davexunit: there is module-submodules
<leoprikler>so you only need to get the top module and then recurse down
<leoprikler>(assuming your app does not resolve-module at runtime)
<davexunit>I don't think module-submodules will cut it.
<leoprikler>well it would if you could access the root module
<leoprikler>but it seems you can't
<davexunit>guile is maintaining a list of everything that has been loaded somewhere
<leoprikler>look at resolve-module, that's where the magic happens
<wingo>davexunit: never done that. how would you deal with dependencies like libffi ?
<wingo>there is certainly an api for seeing all loaded modules, read in ice-9/boot-9.scm
<leoprikler>wingo, where exactly, i can't see it
<leoprikler>boot-9 can see all modules, but I don't think an outsider can
<wingo>hooo, everything in boot-9 is public api for better or for worse
<wingo>i mean we treat it that way when it comes to api / abi compat
<leoprikler>or to be more precise, I don't think anything but resolve-module can, can it?
<wingo>module-submodules
<wingo>ah you refer to "root" being in the closure of resolve-module
<wingo>humm!
<leoprikler>yep and resolve-module '() errors out
<davexunit>wingo: you mean C shared libraries? that's out of scope for what I'm doing. I know what libs I need.
<leoprikler>I think the abi-compatible way of handling that would be to hand out the root module when given the empty list, but that feels weird
<davexunit>I just want to slim down the bundle I'm shipping. the compiled guile modules and source files take up most of the space.
<davexunit>so if I had a way of confidently knowing which I can remove I'd end up with a much slimmer product.
<leoprikler>Hmm
<leoprikler>You could do the following:
<leoprikler>Start from your app module and go up the module-uses
<leoprikler>if it never appears in the uses chances are it's never used
<davexunit>wingo: like if I inspect some modules for their dependencies will I see the boot-9 module in there somewhere?
<leoprikler>That way you don't need to infer everything that's loaded
<davexunit>I'm surprised there isn't a global table of loaded modules. I mean maybe there is and it's just not accessible.
<leoprikler>No direct table and not accessible.
<leoprikler>it's similar to an fs-path really
<davexunit>yeah then trying this is just going to be a waste of time
<davexunit>if I can't answer "what modules are currently loaded?" then that's a blocker right there.
<civodul>davexunit: you can definitely do that via boot-9 APIs
<civodul>module-submodules, the "obarray", things like that
<civodul>it's probably not documented though :-)
<davexunit>maybe I'm just not caling module-submodules with the right args
<davexunit>I keep getting empty hash tables
<davexunit>for things I know include other modules
<civodul>at yes, this one: https://git.savannah.gnu.org/cgit/guix.git/tree/guix/ui.scm#n272
<civodul>it traverses currently loaded modules without loading anything more
<wingo>leoprikler: (resolve-module '() #f)
<davexunit>should have known there would be magic guix code for this
<davexunit>hell yeah (module-submodules (resolve-module '() #f #f #:ensure #f))
<davexunit>thanks civodul
<civodul>yw!
<civodul>it's one of the rare parts of Guile that hasn't changed much since 1996
<civodul>submodules did change a few years ago
<wingo>because it used to be that if you did (define-module (a)) (define b 42) you couldn't then (define-module (a b))
<wingo>because bindings in a module and modules themselves shared a namespace
<wingo>turrible
<civodul>yes, that was a lot of fun
<civodul>thanks for fixing it :-)
<wingo>hehe :)
<davexunit>there's lots of modules like (#{ g114}#) that show up.
<davexunit>I guess those can just be ignored
<davexunit>anything that doesn't map to a file on guile's load path can be ignored
<civodul>right, you can check module-filename i think
<davexunit>yup
<davexunit>this is nice
<wingo>haha that is the reaction of someone with lowered standards ;)
<wingo>"this is nice, you just have to be really careful about what you ask for" ;-)
<davexunit>haha
<civodul>true :-)
<davexunit>I'm cool with it
<wingo>ok so we will roll a 3.0.7 soonish so if you have hotfixes you want in, commit them or poke a committer
*wingo zzz
<wingo>(do ask for feedback if you need it, of course)
<davexunit>did a bug happen in 3.0.6?
<RhodiumToad>at least two of them
<RhodiumToad>wingo: you saw the thing about mini-gmp?
<stis>wingo: checkout bug 48098, kind of annoying. Probably you can fix it quickly.
<ArneBab>leoprikler: I don’t think wisp uses invalidate-compilation-cache. Should it do that?
<ArneBab>leoprikler: from the licensing I’ll need to check what remains
<civodul>sneek: later tell wingo thanks for the super fast bug fixes!
<sneek>Got it.
*davexunit has a working module collector thingy
<davexunit>now to hook this up to bundle generation
<ArneBab>leoprikler: there are 4 changes aside from the emacs mode that are not by me (to the Makefile and the README). I’m checking whether these could be released under the expat license, too, to make embedding in Games easier (similar to gcc exceptions).
<lampilelo>i have two patches if anyone's willing to take a look: one for readline's filename completion (bug #45339) and the second one that got into upstream srfi-64 ref implementation and fixes some stuff i complained about recently
<ArneBab>leoprikler: how do you run your guix recipy?
<ArneBab>recipe?
<leoprikler>changing the last line to the package i want and running guix build -f
<leoprikler>ArneBab: 👆️ for wisp-minimal only that's "wisp-minimal" at the end of the file
<ArneBab>ah, with build
<ArneBab>I tried guix environment --load=guix.scm --ad-hoc, but that didn’t work