IRC channel logs

2023-09-01.log

back to list of logs

<rekado>roptat: in guile-netlink I’d like to get the IP addresses associated with a link. I could use (@@ (ip addr) get-addrs) and match it with get-links, but get-addrs is not exported.
<rekado>likewise, all the accessors for <addr> objects are private.
<rekado>is there a reason not to export them?
<mwette> /join #guix
<nckx>Error: success
<mwette>lol
<morenonatural>hey, y'all... how do I avoid guile from creating a new prompt when it hits an error in REPL?
<dthompson>morenonatural: wrap your expression in some exception handling code
<dthompson>the simplest of which would be (false-if-exception ...)
<morenonatural>dthompson: thx
<morenonatural>hmmm, is there another macro/function to get a hold of the actual error message?
<mwette>catch
<mwette>I think
<dthompson>with-exception-handler would the general thing
<morenonatural>dthompson: will check it out... thanks
<atuin>Hi, is there any way to handle this error: "bytevector-u8-ref: Argument 2 out of range: 2"?
<rlb>atuin: you mean handle it as in catch it and do something, or avoid it in the first place?
<atuin>i want to catch it, yes. I tried but seems it's not working. Maybe there is something special with it
<rlb>atuin: should work I think. For example, using catch:
<rlb>scheme@(guile-user)> (catch #t (lambda () (bytevector-u8-ref (make-bytevector 1) 1)) (lambda ex ex))
<rlb>$2 = (out-of-range "bytevector-u8-ref" "Argument 2 out of range: ~S" (1) (1))
<rlb>Or if you want to be more specific, catch 'out-of-range instead of #t there.
<rlb>(Or rework it to use with-exception-handler)
<atuin>mmm I tried with-exception-handler, maybe I do something wrong
<atuin>`(with-exception-handler (lambda (e) (format #t "~a" e)) (bytevector-u8-ref (make-bytevector 1 1) 2))`
<atuin>mm yeah the catch example works
<atuin>ohhh I was missing the lambda in the thunk :D
<rlb>:)
<atuin>thanks btw :D
<haugh>morenonatural, still here? You can change the on-error repl option to 'report to avoid entering the debugger
<dthompson>ah that's a good one. forgot about that!
<haugh>(system repl common)
<haugh>okay so in addition to repl-option-set! and repl-default-option-set!, there's also the ,option repl command
<haugh>,option on-error 'report
<haugh>This system rocks
<dthompson>if you don't know about making custom repl commands, check it out sometime :)
<dthompson>lots of power to be unlocked there
<haugh>that's on my list!
<dthompson>I just happen to be writing some right now :)
<haugh>ooh! goblins related? just a guess
<dthompson>tangentially goblins related, but I have written some for goblins in the past year.
<dthompson>these are for guile-hoot
<dthompson>the wasm project
<haugh>oh man don't let me distract you, that's a world changing project as far as I'm concerned
<haugh>happy hacking
<dthompson>here's the repl stuff in goblins https://gitlab.com/spritely/guile-goblins/-/blob/main/goblins/repl.scm?ref_type=heads
<dthompson>we extend the repl to have debugging stuff specific to goblins
<dthompson>for the past month or so I've been writing a little wasm interpreter in scheme
<haugh>very helpful demonstration of exception objects as well
<dthompson>heh except I didn't know about define-exception-type at the time which would make it a lot cleaner...
<haugh>I was wondering about that but in effect it makes a really good tutorial
<dthompson>I just totally overlooked it in the manual for some reason
<dthompson>one day I'll go back and fix it
<dthompson>the repl commands I'm working on will make it easy to load, inspect, execute, and debug a wasm binary from the comfort of your guile repl :)
<dthompson>consider this a teaser... more to come when I finish it and blog about it
<haugh>awesome!
<mwette>w/ elisp on guile on wasm I look forward to the day where web fill-ins will have emacs behaviour
<morenonatural>haugh: `,option on-error 'report` works ... but how do I add it to ~/.guile ?
<haugh>morenonatural (use-modules (system repl common)) (repl-default-option-set! 'on-error 'report)
<morenonatural>haugh: thank you
<haugh>yw
<haugh>mwette, I've thought a lot about this and I really think external editor integration is a more productive path, not that I wouldn't like to see more keyboard integration on the web
<haugh>If you're dealing with text complicated enough to warrant a complex editor, you're probably also dealing with people who have strong opinions about the configuration of complex editors
<mwette>yeah - I see your point. I did long ago write a plugin for eclipse that I called "edit-detour" to allow me to edit in eclipse via emacsclient. I could never get it to work robustly.