IRC channel logs

2021-08-25.log

back to list of logs

<avp_>Hello Guilers. Should Guile port "read" callback in C return EOF when an underlying port is closed?
<avp_>Okay, it seems that Guile does not like when an EOF value is returned from the callback. Or probably I did something wrong.
<avp_>Nevertheless I managed to fix an itchy error in Guile-SSH channels: https://github.com/artyom-poptsov/guile-ssh/commit/16fa053a367868754b58d9ad58602d52748db910
<dsmith-work>Wednesday Greetings, Guilers
<vijaymarupudi>0/
<vijaymarupudi>daviid: did the recent auto unref change in g-golf include auto-free for structs?
<daviid>vijaymarupudi: no
<vijaymarupudi>daviid: Ah I see, thanks!
<vijaymarupudi>daviid: (make-pointer <pointer> (c-free-function)) seems useful for that task
<vijaymarupudi>daviid: Also auto unref has been a blessing, thank you very much!
<str1ngs>vijaymarupudi: is (c-free-function) a g-golf procedure?
<leoprikler>i think c-free-function is meant as a metasyntactic variable here
<leoprikler>how much of g-golf is auto-unref now?
<str1ngs>what I thought, though to actually have that would require C snarfing or a guile extension module
<leoprikler>guile-gi does that, but there's other tradeoffs involved then
<pinoaffe>Hi folks, I stumbled upon https://gnuvola.org/software/guile/doc/Module-Monkey.html#Module-Monkey , but (use-modules (ice-9 gumm)) results in "no code for module (ice-9 gumm)" - is this documentation outdated?
<str1ngs>I'm to scared to test to new auto-unref with nomad haha
<leoprikler>are you sure (ice-9 gumm) was ever provided by guile rather than being someone's personal project?
<str1ngs>there are times with gtk you need to ref things or they go away. which can be a PITA
<pinoaffe>leoprikler: I'm not sure
<str1ngs>that guile was a fork back in 2014
<pinoaffe>aah, okay
<str1ngs>or maybe it was 2013
<pinoaffe>I'm trying to access local bindings from other modules, is there a non-forked way to do so?
<leoprikler>@@?
<str1ngs>(@@ (the module) the-binding))
<str1ngs>IIRC
<leoprikler>though careful, @@ is usually discouraged for obvious reasons
<str1ngs>though it's not good practise
<pinoaffe>I know it's not good practise, this is primarily for debugging purposes
<pinoaffe>(and I may end up actually using it if I don't figure out a cleaner way :( )
<pinoaffe>but thanks everybody!
<dsmith-work>pinoaffe: Yeah, that looks like ttn's stuff (Thien-Thi Nguyen)
<ArneBab>just watching a rust-talk where a facebook dev says "new language needs a 10x advantage in some area". What’s the 10x advantage of Guile over other languages?
<ArneBab>(the talk: https://www.youtube.com/watch?v=kylqq8pEgRs )
<ArneBab>For me it is a 10x advantage that I could integrate wisp and get an embedded script writing language for dryads wake: https://hg.sr.ht/~arnebab/dryads-wake/browse/dryads-wake.w
<ArneBab>What’s the 10x advantage for you?
<str1ngs>ArneBab: programs that can introspected and modified as they are running.
<str1ngs>can be *
<str1ngs>pinoaffe: is this for a unit test by chance?
<pinoaffe>str1ngs: no, I'm trying to make the npm-binary importer work with modern guix, and I'm running into some issues
<str1ngs>pinoaffe: you can try something like this. (save-module-excursion
<str1ngs> (lambda _ (set-current-module (resolve-module '(rnrs bytevectors))) (native-endianness)))
<str1ngs>just keep local code in the lambda for sanity.
<ArneBab>str1ngs: do you mean via the REPL?
<ArneBab>str1ngs: which languages do you compare it to?
<str1ngs>I'm assuming this is not for a REPL since you can just use ,m
<str1ngs>sorry that was in relation to pinoaffe's question
<ArneBab>no probs :-)
<pinoaffe>I did ,m (guix import npm-binary) but that did not make the module internals turn up
<str1ngs>it's not listed when you do ,b
<str1ngs>?
<pinoaffe>ah nevermind, typo :(, it's working :)
<pinoaffe>thanks! I guess I'm a bit tired.....
<str1ngs>I should have asked if this was in a REPL :(
<pinoaffe>I'm also interested in how to do this outside of an REPL since I'll probably need to do some monkey-patching in a bit :)
<str1ngs>ArneBab: I'm comparing to say golang C. mostly theses days I'm using C and guile scheme.
<ArneBab>str1ngs: I just decided to make this an incrementally expanded article.
<str1ngs>pinoaffe: try with save-module-excursion
<pinoaffe>ArneBab: this is not specific to guile, but sexpressions and the homoiconicity that it brings are a 10x advantage over the languages I interacted with before guile
<str1ngs>data a code is another bonus. json who?
<ArneBab>yes
<ArneBab>str1ngs: the introspection and modification is at the repl, right?
<str1ngs>ArneBab: yes, but you can create your own REPL or create a REPL socket. I regularly introspect nomad using geiser. and evaluate new code without restarting nomad.
<ArneBab>So you connect to monad and then just hack it?
<ArneBab>Are there cases where you need to restart?
<str1ngs>most of the time yes, I'm hacking on nomad while it's running. though normally I'm using a development instance.
<str1ngs>it's very rare I need to restart. depends what I'm hacking on.
<ArneBab>do you have an example? (I’d like to include it)
<str1ngs>ArneBab: say I want to change this (define %search-provider-format "https://duckduckgo.com/?q=~a") to google. I can either evaluate the new variable define. in ~/.nomad using geiser. or in a REPL attacked to nomad sockets. I can just do (set! %search-provider-format "https://google.ca/?q=~a")
<ArneBab>Is there a point where that fails? Inlining for example?
<str1ngs>set! is not the best example most cases fluids or parameters are used.
<str1ngs>it fails at times. its very like how you would hack on emacs when you think about it.
<ArneBab>You can change top-level defines, fluids and parameters for all modules?
<ArneBab>What I’d like to include is an example where it fails
<str1ngs>when using fluids and parameters you don't need to change them you just using then contextually
<str1ngs>for (with-bufffer (current-buffer) (load-uri (current-buffer) "https://gnu.org"))
<ArneBab>Example: For Java development it breaks when you change function arguments or streams (the latter really hurts).
<str1ngs>I think java has function overloading?
<ArneBab>str1ngs: yes, but hot code reloading doesn’t work when you change function parameters.
<str1ngs>I guess that could happen with guile and generic methods too.
<ArneBab>can you replace a procedure definition from the REPL and have it just work?
<str1ngs>yep
<ArneBab>That’s already much more powerful then :-)
<str1ngs>mostly in those cases I eval the new define with geiser. but you can do the same in a REPL
<dsmith-work>ArneBab: 10x advantage? Actually, I've been really digging Rust lately.
<dsmith-work>ArneBab: But hacking in Guile/Scheme is just lots of fun.
<vijaymarupudi>str1ngs: I just used a wacky notation for a pointer to the c free function
<ArneBab>str1ngs: thank you!
<str1ngs>vijaymarupudi: I though as much. It's just I do have situations where I need to free C pointers when using g-golf. but those might not even be needed now. I need to revist some of my C hacks
<ArneBab>dsmith-work: I like Rust from the tools people write with it. I flat out hate Rust when I have to wait for it to bootstrap :-)
<dsmith-work>ArneBab: By far the most painful thing about Rust is waiting for compiles.
<ArneBab>pinoaffe: what’s the advantage s-exps and homoiconicity brings for you?
<ArneBab>dsmith-work: three days ago I aborted my Guix update twice because I did not get a substitute and the Rust update took more than two days. I switched to using a manifest, because that failed.
<vijaymarupudi>str1ngs: Yes, I do too, but I see a way forward for g-golf where all the finalization can be done automatically. Haven't found time to work towards a contribution myself, but until then, bug reporting and providing suggestions to daviid shall do :)
<dsmith-work>ArneBab: Ugh
<pizzapal>is there a way to create a SCM_UNDEFINED object in guile? i could have sworn there was something in the (system foreign) module, but i must have been thinking of %null-pointer
<dsmith-work>pizzapal: make-undefined-variable
<vijaymarupudi>Q: Is there some sort of packaging guide for making packages for guile? I'd like to do the bare minimum with autotools if I can help it, since my package is pure scheme
<dsmith-work>pizzapal: But generally, I don't think you want any SCM_UNDEFINED values floating around at the scheme level. It's used for unsupplied arguments.
<pizzapal>should i just use a keyword like #:undefined or something? i just need a flag to know if a variable has been bound or not.
<ArneBab>vijaymarupudi: you could try to start with the guile template in conf: https://hg.sr.ht/~arnebab/conf
<ArneBab>$ conf new --lang guile --vcs git test
<ArneBab>pinoaffe: (defined? 'name)
<ArneBab>pizzapal: (defined? 'name)
<ArneBab>anyone want to comment on srfi-227 (opt-lambda) from a Guile perspective? https://srfi.schemers.org/srfi-227/srfi-227.html
<pizzapal>oh yeah, i think i can use the scoping and maybe call/ec to un-bind things
<pizzapal>i suppose that would be more efficient and idiomatic and stuff
<stis>greetings guilers!
<vijaymarupudi>ArneBab: Thanks for the pointer, will take a look
<ArneBab>str1ngs, pinoaffe, dsmith-work: Here’s the quick article for the 10x advantage. Thank you for your replies! https://www.draketo.de/software/guile-10x
<ArneBab>vijaymarupudi: conf is a project I started. It isn’t really cleaned up and I don’t have the time to really polish it, but it works.
<dsmith-work>ArneBab: hah!
<ArneBab>also it creates a self-contained project: You only need conf for the creation, afterwards you have a working autotools-setup.
<ArneBab>dsmith-work: :-)
<vijaymarupudi>ArneBab: which is pretty much what I'm looking for :)
<vijaymarupudi>Some guides or blog posts on this topic would probably benefit the community
<ArneBab>conf uses https://www.draketo.de/proj/with-guise-and-guile/guile-projects-with-autotools
<ArneBab>just packaged as tempplate
<ArneBab>vijaymarupudi: if you want to write about conf, feel free to :-) — if you want to improve it, feel double free to :-)
<vijaymarupudi>Ooo, that's nice!
<vijaymarupudi>ArneBab: I probably will!
*ArneBab is happy
<ArneBab>the only skill you need for that is shell-scripting, because conf is implemented in bash, because that’s also needed in autotools, so it does not add more dependencies. Where you can use autotools, you can use conf.
<ArneBab>to hack it, look at conf.in :-) → https://hg.sr.ht/~arnebab/conf/browse/conf.in?rev=tip
<ArneBab>different project languages are defined in templates: https://hg.sr.ht/~arnebab/conf/browse/templates?rev=tip
<ArneBab>It’s also how I nowadays start wisp projects, and it should be possible to use it to define autotools-templates for arbitrary projects.
<vijaymarupudi>ArneBab: I see, appreciate the walkthrough! I'm new to autotools, never needed the portability, but this might be a good excuse to learn a little bit to understand conf
<ArneBab>That would be cool!
<ArneBab>and a great outcome from writing conf
<vijaymarupudi>Here's my 10x advantage: Guile is particularly great for prototyping and creativity, and its performance allows for such experiments to be deployed to the world with minimal changes
<vijaymarupudi>I've been using it a lot lately for data cleaning and modeling, and it's been great
<ArneBab>sneek later tell vijaymarupudi: which language do you compare it to?
<sneek>Okay.
<ArneBab>sneek: botsnack
<sneek>:)
<ArneBab>sneek later tell vijaymarupudi: and which aspect of Guile makes it great for prototyping and creativity?
<sneek>Will do.