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. <vijaymarupudi>daviid: did the recent auto unref change in g-golf include auto-free for structs? <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 <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 <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>I'm trying to access local bindings from other modules, is there a non-forked way to do so? <leoprikler>though careful, @@ is usually discouraged for obvious reasons <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 :( ) <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? <str1ngs>ArneBab: programs that can introspected and modified as they are running. <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: 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 <pinoaffe>I did ,m (guix import npm-binary) but that did not make the module internals turn up <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>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 <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? <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 <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 :) <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 <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>$ conf new --lang guile --vcs git test <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 <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. <ArneBab>also it creates a self-contained project: You only need conf for the creation, afterwards you have a working autotools-setup. <vijaymarupudi>Some guides or blog posts on this topic would probably benefit the community <ArneBab>vijaymarupudi: if you want to write about conf, feel free to :-) — if you want to improve it, feel double free to :-) <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>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>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? <ArneBab>sneek later tell vijaymarupudi: and which aspect of Guile makes it great for prototyping and creativity?