IRC channel logs

2020-04-03.log

back to list of logs

<jcowan>If there is a way to get a pipe on the child's stderr, I don't know what it is.
<ThomasAlbers>I mean something to avoid (open-pipe "echo test | cat" OPEN_READ) where i have to build a string and use a shell
<alextee[m]>btw, what does scm_call_0 () return? i found this: ret = vm_engines[vp->engine](thread);
<alextee[m]>(docs don't mention what is returned)
<str1ngs>alextee[m]: scm_call_0 returns SCM
<str1ngs>IIRC
<alextee[m]>yeah, but what does it represent?
<alextee[m]>according to %p it returns "0x804" when it succeeds
<str1ngs>alextee[m]: can be any scheme type, so depends what proc you call. say (define (bar) "baz") if you call bar it return SCM which you can get with scm_to_locale_string
*alextee[m] is basically looking for a way to detect if there were any errors (and hopefully get the error message) when running scm_call_0()
<alextee[m]>ah i see so it's dependent on the script
<str1ngs>well you can wrap it in a C exception
<str1ngs>using scm_c_catch
<str1ngs>but that can be tedious from C. I try to just check the return types. and let scheme throw it's exceptions
<str1ngs>alextee[m]: maybe have one toplevel scm_c_catch. probaby you are using eval for user stripts so I make that eval safe.
<alextee[m]>str1ngs: oh this looks like what im looking for, thanks!
<str1ngs>alextee[m]: see http://git.savannah.nongnu.org/cgit/nomad.git/tree/scheme/nomad/buffer.scm?h=feature-g-golf#n96 . here is a safe eval that eval's a buffer. kinda like your text input window
<str1ngs>alextee[m]: also I find only write C defines for the most minimal use case. and use scheme modules scripts everywhere else.
<alextee[m]>i see
<alextee[m]>does that catch syntax errors too?
<str1ngs>alextee[m]: yes
<str1ngs>I mean yes it catches syntax errors
<alextee[m]>wow, scheme is cool
<alextee[m]>i guess it runs things sequentially so as long as there's no syntax errors before the catch it will catch any syntax errors inside.. probably
<str1ngs>I'm still quite new to scheme to comment on that. other can explain unwind etc
<str1ngs>alextee[m]: I'd probably have some top level scheme that calls the SCM_DEFINE with a catch.
<str1ngs>so something like (define (eval-user-input text) (catch #t ....)) you get the idea.
<str1ngs>alextee[m]: then you don't need to use scm_c_catch because it's tedious :)
<alextee[m]>i'll probably do it in C with scm_c_catch
<str1ngs>your call :)
*alextee[m] found an example in nomad
<str1ngs>oh no, is it good example :)
<alextee[m]>qt/keymap.cpp
<str1ngs>ah yes
<str1ngs>all that qt code is gone now :)
<str1ngs>eventually I hope to use https://github.com/mrosset/giqt. so you can use QT from scheem.
<str1ngs>err scheme*
*alextee[m] seems M4/GObject/QT in a single project and tries to calculate how this could possibly work
<alextee[m]>+ scheme
<str1ngs>alextee[m]: it works see. https://github.com/mrosset/giqt/blob/master/examples/hello.scm.in
<alextee[m]>wow
<str1ngs>don't show this the the GTK folks they will hate this idea haha
<alextee[m]>lol
<str1ngs>I think I can avoid this though. I only need the qtwebengine control
<str1ngs>though giqt would be fun for others to use I guess.
<str1ngs>also this works with sbcl, python, JS . see https://github.com/mrosset/giqt/blob/master/examples/webview.lisp'
<str1ngs>alextee[m]: GOBject is not so bad. its deriving GtkWidget which is probably not the best.
<alextee[m]>str1ngs: i think that's the other way around. GtkWidget inherits from GObject
<alextee[m]>it does sound useful for bindings though
<str1ngs>right, but but I derive from GtkWidget since it gets things working faster. notice I can do gtk_container_add
<str1ngs>probably can derive from GObject and then have a QTContainer.
<alextee[m]>oh yeah if you're doing custom widgets you're supposed to inherit GtkWidget afaik
<str1ngs>this is just proof of concept anyways.
<alextee[m]>or whatever's similar to the widget you're doing, but for just drawing with c airo the gtk devs said you should use GtkWidget
<str1ngs>for this I QtWidget derives from GtkContainer. due to how QT works. all controls are containers
<str1ngs>same principle though
<alextee[m]>i'm amazed how you can do that. i'm aware of some other kind of hack to run qt in gtk using C, but just inheriting widgets to do it is new to me
<str1ngs>then I override certain methods
<alextee[m]>GtkPort or something like that, where you get the X11 window of the qt thing and embed it in a gtk container, or something like that
<str1ngs>alextee[m]: that's the approach I'm going to probably use for nomad
<str1ngs>this way I only need to emmbed qtwebengine the rest can stay GTK
<alextee[m]>you might find this project interesting http://drobilla.net/software/suil
<alextee[m]>it's a library that allows a host to embed widgets from other toolkits
<str1ngs>only Gtk 2, Qt 4 though
<str1ngs>which makes webkit2 not usefult
<alextee[m]>str1ngs: that description is old
<alextee[m]>it does qt5 and gtk3 now too
<str1ngs>I think for nomad the X11 embedding would be better. less code
<alextee[m]>raw x11 embedding is probably the best idea IMO
<str1ngs>though theoretically if a designed it right you can use more then one backend
<alextee[m]>both gtk and qt support it afaik
<str1ngs>right, I'm going to write a typelib that proveds a qtwebengine control. then I can use it from scheme with g-golf
<str1ngs>will be awhile before I get there though. webkit is pretty good IHMHO
<str1ngs>also my buffer use generic methods so. load-uri would work on any web buffer class
<str1ngs>alextee[m]: does your program support midi?
<alextee[m]>str1ngs: yep
<str1ngs>I'll have to try it with my midi keyboard :)
<alextee[m]>it's in guix already :-)
<str1ngs>will check it out
<alextee[m]>still alpha though
<str1ngs>I hear ya, nomad is still pretty alpha too. though it's come along way. the g-golf branch is about 300 revision ahead of master now.
***rekado_ is now known as rekado
*guix-vits Hi there; *afk*
<d4ryus>hi, i would like to save the current module, evaluate something and then switch back to it. (current-module) returns the current module, but i cannot find a function to switch back to it, is there one?
<rekado>d4ryus: you can use save-module-excursion
<rekado>I use it with set-current-module to evaluate some user-provided code in a configured environment without affecting the current module.
<phoe>Hey! I have a design question. What is the reason that some vector operations in Guile have only destructive variants in standard (vector-set! for example)? I just ran into a use case where I could use a copying/non-destructive vector-set, but I would need to define it manually via copying the original and then mutating it.
<phoe>(also, the https://gnunet.org/bot/log/guile link from the topic is broken.)
<brendyyn>phoe: perhaps we should create a batteries included bytevectors libarary. I've been using them in my current project and found there isnt everything i need in (rnrs bytevectors). I've written bytevector-reverse, bytevector->number, bytevector-append, and used guix's base16-string->bytevector.
<civodul>phoe: i don't see the gnunet.org URL in the topic
<phoe>civodul: oh right! sorry, it was in the ChanServ autojoin message
<phoe>09:57 -ChanServ(ChanServ@services.)- [#guile] Welcome to #guile! This channel is logged, see <https://gnunet.org/bot/log/guile>.
<phoe>brendyyn: my issue is that Guile is a functional programming language by definition, and yet it doesn't really provide functional operators for vector access. One needs to construct it oneselves, or - as you mentioned - use a library from an external source.
<phoe>(I don't mean just bytevectors though - general vectors are affected, too.)
<daviid>phoe: there is a fectors (functional vectors) library somwhere
<sneek>Welcome back daviid, you have 1 message!
<sneek>daviid, str1ngs says: can you confirm for me that changing the test 'test-g-value-get-pointer to use /dev/null is okay. guix build environement does not have /dev/tty. I'm pretty confident /dev/null is okay WDYT? I can substitute this so no need to change it.
<brendyyn> https://bitbucket.org/bjoli/guile-fector/
<phoe>daviid: thanks!
<brendyyn>the amound of javascript required just to display that text page...
<phoe> https://hg.sr.ht/~bjoli/guile-fector
<phoe>much less javascript required
<brendyyn>oh golly golly
<phoe>and it seems it's more fresh than the BB version
<phoe>(even if just a bit)
<brendyyn>my librejs loves it
<phoe>Drew's orthodox minimalism has its upsides, yes
<d4ryus>rekado: save-module-excursion is exactly what i was looking for, thank you!
<dsmith-work>Happy Friday, Guilers!!
*alextee[m] uploaded an image: Screenshot from 2020-04-03 14-06-29.png (53KB) < https://matrix.org/_matrix/media/r0/download/matrix.org/zxmqINJQMrRxPSLiOBjwOVCA >
<alextee[m]>str1ngs: well, i still can't figure out how to get the "what went wrong" message from catch, but scm_c_catch worked in detecting if an error occurred! ^
<chrislck>alextee[m]: you can always (define last-catch-error "") ... (catch etc (set! last-catch-error "error explanation")) then from C, you can call scm_c_eval_string ("last-catch-error") to retrieve the error message
<alextee[m]>chrislck: is that possible to do from C?
<alextee[m]>i want the scheme to be as simple as possible so it's easy to get into for users with no programming experience
<alextee[m]>unless you mean running that scheme code from C before running this script
<chrislck>you can wrap your user-supplied guile script with a catch
<chrislck>see https://github.com/Gnucash/gnucash/blob/maint/libgnucash/app-utils/c-interface.scm#L18 now imagine cmd is the user-supplied string
<chrislck>actually https://github.com/Gnucash/gnucash/blob/maint/libgnucash/app-utils/c-interface.scm#L63 is the better snippet -- see how it stores the error in gnc:last-captured-error
<chrislck>and https://github.com/Gnucash/gnucash/blob/maint/gnucash/report/report-gnome/window-report.c#L277 is how to display it back on screen
<alextee[m]>chrislck: interesting, thanks! i will try this now
<chrislck>the functional way would be for (catch) to run the script, and will return (list 'success output) or (list 'failure error-message) then process the 2-element list in C
<alextee[m]>are display-backtrace and print-exception standard scheme procedures that return the actual errors?
<alextee[m]>i mean, can't i just run those in my catch handler in C?
<alextee[m]> https://www.gnu.org/software/guile/docs/docs-2.2/guile-ref/Capturing-Stacks.html
<alextee[m]>there's an actual example here in C! nice
<chrislck>levelling up in scheme means you unlock more chapters in the book ^_^
<alextee[m]>ah segfault, i'll try in scheme then lol
<alextee[m]>i guess just format string on that example and put my script code in an %s
<alextee[m]>and just print the stack to the error out port
<chrislck>s/%s/~s
<chrislck>ah format from C uses %s
<alextee[m]>i will format the string in C before calling the whole thing with scm_call :-)
<srandon111>guys any good book in guile?
<srandon111>*about* guile?
<dsmith-work>srandon111: Several good books on Scheme, but nothing Guile specific that I know of.
<luni>Hi all i would like to ask information regarding OOP in Guile. I'm looking at the available online documentation and all is fine, anyway there is any introductory resource for interfaces/protocols to be used in the context of OOP with GOOPS? Thank you in advance
<rekado>luni: is there something specific you are missing from the Guile reference manual on GOOPS?
<alextee[m]>is there a C equivalent to (print-exception) ?
<luni>thank you for the answer, i will try to explain my situation to be more precise for what is possible
<alextee[m]>searching for "print_exception" doesn't bring up something in the guile docs
<luni>(premise) I'm new of OOP.... i have few classes and a lot of generic methods so inheritance is working well. But since generic methods are a lot i would like to have an efficient way to look at my code
<luni>and classes are not explicitly describing the methods that are related to them
<luni>so for me ok... all is working, but is a mess to read my own code.
<alextee[m]>grep to the rescue! found it in backtrace.h
<luni>so i'm searching some reference about good practice to follow in OOP even from a stylistic point of view
<luni> perhaps some examples from which to draw inspiration would be fine
*alextee[m] uploaded an image: Screenshot from 2020-04-03 16-12-08.png (95KB) < https://matrix.org/_matrix/media/r0/download/matrix.org/xStaRYjwMZwmUSThKPrEVWhn >
<alextee[m]>the guile scripting interface is complete! i went with the C approach: https://git.zrythm.org/cgit/zrythm/tree/src/gui/widgets/scripting_window.c?h=bugfixes
***dozzie is now known as dozzie_
***dozzie_ is now known as dozzie
<manumanumanu>Ahoy hoy, guilers!
<manumanumanu>Is there a reason we don't have define-inlinable* with keyword and optional arguments? Looking at define-inlinable I think I could maybe make it work...
<manumanumanu>scissoring some stuff from ice-9 optargs
<civodul>manumanumanu: no good reason i guess!
<manumanumanu>define-inlinable could trivially be implemented using define-inlinable*: you could just validate that all the formals are identifiers and dispatch to lambda* which "downgrades" to lambda when there are no keywords
***rubdos_ is now known as rubdos
<manumanumanu>civodul: would there be any interest in such a patch? I understand adding things to boot-9 isn't really anything anybody wants to do, but I know I have not been alone in trying and being frustrated that it did not work.
<civodul>manumanumanu: why not, worth discussing
<manumanumanu>I'll make a post in guile-devel
<manumanumanu>better forum
<civodul>yeah
<str1ngs>hello, when using a public parameter is it advisable to use the % naming prefix?