IRC channel logs

2023-01-20.log

back to list of logs

<dadinn>hmm, actually (let () (+ 1 2 3)) is valid expression!?
<dadinn>:/
<akirakyle>.
<sneek>Welcome back akirakyle, you have 1 message!
<sneek>akirakyle, daviid says: i pushed a series of patches that fix both callback procs and vfunc methods arg values, and updated the peg-solitaire example ... when you have some time, please pull, make, install, try and let me know - i will now work to add the 'Unimplemented type - array; (c -1 #f 1 interface)', will let you know when done ...
<akirakyle>daviid: Great! It looks like the latest devel commit at least doesn't break anything I had running before, looking forward to the calling functions with array arguments being implemented!
<daviid>flatwhatson: for info, i first pushed a small patch with the ffi-pack-double proc and its libg-golf C code that I used to track the bug - i did thank you in the commit https://git.savannah.gnu.org/cgit/g-golf.git/commit/?h=devel&id=15e689d3446632d4a78e4b02c20495b4b0a4ba22, then i went ahead and wrote the scheme solution i was refering to when we discussed 'liguile or not libguile' ...
<flatwhatson>daviid: great, glad you got a nice solution in the end :)
<daviid>akirakyle: when i run this example, based on your 'moving-text' one, i get what appears to be a correct x value, but the y seems incorrect (?) - not familiar with the pango renderer interface ... do you have any idea why would that be? - https://paste.centos.org/view/6bda0537 - dimfi called line 65, gives me - ;; draw-glyphs-vfunc #<<pango-cairo-fc-font> 7f70998ac2d0> #<pointer 0x5643348b3340> x 50 y 11456
<akirakyle>Actually both those x and y values seem reasonable to me
<daviid>akirakyle: ok, why is the y so 'big'?
<akirakyle>daviid: IIRC they're in pango units so divide by PANGO_SCALE
<akirakyle>which is 1024
<akirakyle>And I assume it's picking up some default font options around a 12pt font
<daviid>akirakyle: ah ok, make sense indeed then
<akirakyle>daviid: What's weird is that over here I'm still getting very wrong large negative values for those
<akirakyle>This is with the latest g-golf devel branch commit you're running what you sent?
<daviid>akirakyle: yes the latest ...
<daviid>akirakyle: that is a sign you are not using the latest indeed
<akirakyle>daviid: Hmm, I guess that points to differing gobject or pango versions
<daviid>akirakyle: i don't think so, i would inestigate your guix config ..
<akirakyle>daviid: Actually yeah you're right, I forgot guix likes to cache shells, so I gotta refresh that...
<daviid>akirakyle: right - keep this in mind/notes to help other guix users ... tx
<daviid>akirakyle: it would be nice of guix could 'pull a trigger' and let its users know ...
<akirakyle>daviid: This is well documented in guix-land, nothing to do with g-golf, and just a convince thing when doing "containerized" development with guix shells, I'm just forgetful sometimes
<akirakyle>daviid: A small price to pay for the ability to do development against arbitrary sets of versions of dependencies
<daviid>akirakyle: ok, as long as you're happy and potentially can help other guix users, i am happy to :)
<akirakyle>daviid: Alright, I now actually have the latest devel g-golf set up and can confirm that the x and y values are now what I expect!
<akirakyle>daviid: Thanks so much for looking into this bug and getting it fixed!
<daviid>akirakyle: perfect, and the peg-solitaire example should also work, it no longer 'manually' calls get-intrinsic-width[height] and relies on the snapshot-vfunc width height arg values ...
<daviid>can you try that to? you'd recompile the peg-solitaire example
<akirakyle>daviid: Yeah I saw that change, it's nice that these ended up being the same bug, I was worried I would have to really dig into pango to debug this
<daviid>akirakyle: hen you face a bug, 99.99% chances are it is a g-golf bug ...
<akirakyle>daviid: Yep peg-solitair works here for me (not that I really know how to play it)
<daviid>ok great
<dthompson>following up on my attempted mingw build: I had to copy all the necessary dlls into the same directory as guile.exe to get wine to attempt to run it, but ultimately I get this error: "32 bit pseudo relocation at 0000000140001568 out of range, targeting 0000000319370E80, yielding the value 00000001D936F914."
<dthompson>I'm not a wine/windows person, so I'll stop here for now. I know I've had a guile build that failed in wine but worked on windows in the past, but I don't think I'll go through all the effort to get my old windows machine running again to test.
<daviid>akirakyle: i just pushed a fix for the 'array of interfce(s)' missing type
<daviid>akirakyle: here is an updated version of your example - https://paste.centos.org/view/20de42d1 - see line 76, in scheme, you pass a list (i could override those constructors so users don't have to pass the list length ... but i haven't done so yet ...)
<akirakyle>daviid: Great! Giving it a test now...
<akirakyle>daviid: Would the rule to translate the c function signatures to g-golf calling convention then be to always omit the argument denoting the list length?
<akirakyle>daviid: Also should these always be guile lists, what about calling with a vector?
<akirakyle>daviid: Woohoo!!! I got my more complicated example with multiline text bouncing and a custom pango rendere to work now!
<akirakyle>daviid: Here's the example: https://paste.sr.ht/~akyle/34263d3f72f0d4aa093976ab19c1215aef2fe7ad
<akirakyle>daviid: I'm hopping off for a little but I'll be back on a bit later
<lilyp>akirakyle: you shouldn't need list/vector lengths in guile because g-golf can simply infer them by calling or vector-length
<lilyp>s/or/length or/
<daviid>lilyp: yes, but currently, this only happens for those upstream functions/constructors that i manually override in g-golf, so as an example, there is currently no 'automatic' mechanism and so, i.e. gsk-container-node-new needs both the list and its length ...
<akirakyle>daviid: But gobject introspection does give you the info on which c arguments correspond to which list pointers right? So in principle this can be done automatically when such info is provided?
<daviid>akirakyle: also, to answer your previous quiz, you should always expect to pass a scheme list for those C types that expect arrays ... i do not plan to change that in the near future
<lilyp>akirakyle: in principle yes, if the annotation's there. That's what guile-gi already does
<akirakyle>sounds good!
<daviid>it is defintely possible to automate, just amatter of priorities - i am dead happy i did concentrate on other and far more important priorities :), mean while, asking g-golf users to pass the length of those list when the upsdtream function/method requires that parameter ...
<akirakyle>daviid: Maybe this is another bug or maybe needs clarification if I'm doing something wrong here. Essentially I'm trying to call pango_layout_get_pixel_extents (https://docs.gtk.org/Pango/method.Layout.get_pixel_extents.html) which gives two structs, but I seem to be only getting one of them here:
<akirakyle> https://paste.sr.ht/~akyle/47ca84be6cdc6b76a3d61f37e4c27b8ed2197b0f
<dokma> If I have a bunch of worker threads and a controller thread, what is the proper way to signal shutdown to the worker threads from the controller?
<akirakyle>daviid: Also it looks like the trivial case of passing the empty list is failing with "Invalid array argument:  ()"
<haugh>Guile has some /sick/ XML facilities. Is anyone using it with htmx?
<civodul>with HTML? yes, though HTML is not quite XML, so there are a couple of things to pay attention to
<civodul>see Haunt as an example
<ArneBab>haugh: I use sxml->xml — that’s pretty awesome for simple templates: https://hg.sr.ht/~arnebab/guile-freenet/browse/fetchpull.w?rev=tip#L794
<haugh>I'm curious specifically about approaching https://htmx.org/, though I'm an avid reader of dthompson's work and I previously explored Artanis
<haugh>cool, AneBab
<civodul>oh sorry, i didn't know about htmx
<haugh>I'm new to all of it but my instinct is that the combination of Guile's SSAX with the Locality of Behavior paradigm could make server-driven web very, very much approachable to people like me who hate the web
<haugh>ArneBab, your code is always a trip, my dude
<ArneBab>haugh: thank you :-)
<ArneBab>haugh: htmx looks interesting, but I fear that it has tons of JS in the background … (only a small glance). But creating this from guile could be pretty nice.
<ArneBab>haugh: did you already look at guilescript (for extending that)? https://github.com/aconchillo/guilescript/blob/master/examples/fibonacci-server.scm#L28
<ArneBab>why I think that great: https://www.draketo.de/software/wisp#guilescript-2023-01-10
<ArneBab>using Javascript inside standalone templates and Guile in the backend, for dynamic generation of- HTML and JS, and for the backend⇔frontend interface.
<haugh>I saw this when I was first getting into Scheme. Gave me one hell of an impression of Guile, but it doesn't seem practical yet. HTMX is often extended with what they call hyperscript, and if I tried to tie HTMX and SSAX together I would definitely try my hand at writing an EDSL for hyperscript
<haugh>First, I would probably need to finish at least one of the many tasks I'm procrastinating by reading about the subversive resurgence of XML/REST >.>
<ArneBab>I’m using hyperscript at work. It’s pretty nice to use — until you really start to use web components, then it gets a bit annoying, because it kills your linter. We are now switching to typescript (not my choice …) and there hyperscript creates a type-barrier so people think they can just refactor without checking usages and break other parts of the site that way.
<ArneBab>haugh: overall I don’t see much use in hyperscript if you can use sxml->xml, because that already does what hyperscript does, but with less overhead.
<rekado>haugh: I stumbled upon htmx repeatedly (not the hyperscript part, which I find boring) and wanted to use it, but never actually made the jump
<rekado>I’m just using plain sxml
<haugh>ArneBab, Thank you for the critical perspective.
<haugh>rekado, I'm right there with you. Flirting with it.
<rekado>the value I saw in htmx is all the hx-* attributes that abstract away some of the annoying HTML+JS bits
<ArneBab>haugh: this is from creating a big geoinformation, -mapping and -reporting tool in a team of ~30 people, so it might not apply for smaller sites or sites which don’t need that much dynamism in their web components.
<haugh>rekado, Yes! Generating that slick syntax by unquoting sexps makes me actually want to build web
<haugh>ArneBab still, that's the perspective I can't get from reading the tech's own site, you know? Was it just a talent pool sort of logic that pushed your team towards TS or were there quantifiable wins?
<rekado>recently I started using pre-post-order a little more, so that I can build plain sxml and have special tags expand to fancier markup.
<rekado>I do this as an alternative to quasiquoting and splicing.
<haugh>interesting
<ArneBab>haugh: what pushed us to TS is that some people really wanted it. In my opinion the result has been mixed, but I was against it from the start (did not want to build that huge dependency on microsoft, since our tool has to live for at least one decade).
<haugh>In my experience you're either ambivalent about it or you're an absolute fanatic
<haugh>That's a weighted average.
<ArneBab>haugh: results: Our Java developers have an easier time getting into web development. Types make our code base much more complex (but they are similar enough to Java types that most can keep their skills). We had to disable useful eslint rules, because they don’t work with typescript. Some approaches that were ideal with Javascript had to be changed to map to Typescript.
<ArneBab>haugh: also we had decided to take it slow, so we could decide after a few months when everyone had gotten some experience with it. Instead of this some people rushed forward and when it came to deciding, the results were mixed, but it was clear that we couldn’t afford to undo it.
<ArneBab>haugh: in that process every worry I had about Typescript except for one was proven right.
<ArneBab>(I wrote them down at the start so I could actually check them later)
<haugh>I loathe every twisted amalgamation and toxic excretion of the OO paradigm and I have reserved my last breath for a curse upon its followers
<ArneBab>:-)
<dadinn>hi all
<rekado>I was shocked to learn that TypeScript’s type system is unsound
<rekado>you can easily violate typing rules, e.g. push a number onto an array of strings
<ArneBab>haugh: please check your msgs …
<civodul>SomewhatTypedScript
<ekaitz>civodul: are you really testing lightening or you are just playing with me :)
<civodul>ekaitz: i am not!
<civodul>but i'd like to give it a try eventually
<ekaitz>civodul: LUL
<civodul>i'd like to get 3.0.9 out of the door first, so don't hold your breath
<civodul>but yeah, let's not let the RISC-V port bitrot :-)
<ekaitz>it seemed like all we needed to do was to --with-source and have some fun but nobody really managed to do it properly
<ekaitz>(me neither)
<ekaitz>civodul: it's already a year and a half that I made it :)
<civodul>yeah, i understand :-/
<civodul>it's not just --with-source here because lightening is a submodule
<civodul>so we first need to update the submodule in Guile
<ekaitz>yeah...
<civodul>another issue is that there are zero substitutes for riscv64-linux
<civodul>efraim: do you happen to publish substitutes somewhere?
<ekaitz>sure
<efraim>civodul: https://git.sr.ht/~efraim/guix-config/tree/master/item/3900XT.scm#L103, at k7muufoychzetmq7evsv6gcq4sxq4olxo3uy2zlhek5fkfvl5uscbgyd.onion, although I've been told it's not super reliable
<efraim> https://git.sr.ht/~efraim/guix-config/tree/master/item/Extras/3900XT_publish.pub for the key
<efraim>if need be I can see about forwarding the port to flashner.co.il
<civodul>efraim: awesome, that'll be super helpful
<civodul>let's see what i can do in the coming weeks
<efraim>civodul: http://flashner.co.il:3000 seems to be up. I'll see what I can do about keeping it up
<lloda>is it ok to say that definitions are evaluated? for example @cindex body
<lloda>sorry. For example https://www.gnu.org/software/guile/manual/html_node/Local-Bindings.html says 'the expressions in body are evaluated in order' but that can contain definitions. Can you say 'the expressions and definitions in body are evaluated in order'?
<sneek>dsmith-work: Greetings :)
<dsmith-work>sneek: botsnack
<sneek>:)
<dsmith-work>Happy Friday, Guilers!!
<civodul>howdy dsmith-work!
<civodul>ACTION uploads 3.0.9rc1
<mfiano>ACTION downloads 3.0.9rc1
<mfiano>civodul: Thanks for all your work!
<mfiano>(and everyone else ofc)
<count3rmeasure>wow, it seems gnu.savannah.org is choking a bit at the moment?
<count3rmeasure>keep getting timeouts trying to download the testing branch
<count3rmeasure>sorry, wrong url
<lechner>Hi, what does the -s switch do here. Does it not require an argument? Thanks! https://git.savannah.gnu.org/cgit/guix/maintenance.git/tree/hydra/goggles-bot.scm#n2 https://www.gnu.org/software/guile/manual/html_node/Command_002dline-Options.html
<mirai>are there any sxml apply-templates examples?
<ArneBab>lechner: as far as I remember it’s used to run a file as script: guile -s FILENAME
<ArneBab>but it’s the default, so you don’t usually need it.
<lechner>ArneBab / thanks!
<mfiano>lechner: I do this in shebang scripts:
<mfiano>#!/usr/bin/env -S guile -e 'main' -s
<mfiano>#!
<mfiano><rest of script>
<mfiano>where <rest of script> includes some guile code and a procedure named main.
<lechner>mfiano / thanks for the -S to env! i did not have that
<lechner>mfiano / is it good practice to add the -s?
<mfiano>I am a newbie. After a lot of trial and error, that is what worked best for me. I wanted to be able to have standalone guile scripts in addition to managing projects with guix. YMMV :)
<lechner>mfiano / you mean use the script as a module?
<lechner>actually, that's not quite right
<lechner>what do you mean, please?
<mfiano>I'm not sure what you are asking.
<lechner>which advantage do you gain from the 'main' entry point, please?
<mfiano>I find it cleaner to not have load time side effects or toplevel forms that shouldn't be toplevel.
<mfiano>There may be advantages, but I do not know what they are.
<lechner>mfiano / yeah, i just found a global identifier issue after switching to main. i thought there might be other advantages like being able to avoid starting a separate interpreter
<mfiano>I think the 'main' idea was flatwhatson's and they had similar preferences. I could be mistaken though; a few weeks ago several people offered many suggestions in this regard when I was getting set up.
<lechner>okay, thanks!
<mfiano>You might be able to search the IRC logs, if you are desperate enough. It wasn't that long ago :)
<lechner>mfiano / i'll have a look. thanks!
<mfiano>No problem. Sorry I don't have any real answers. It seems everyone does this very differently from all the suggestions I remember getting.
<lechner>mfiano / actually, you've helped a lot! and i'm a noobie too
<daviid>sneek later tell akirakyle wrt your pango-layout-get-pixel-extents, it returns multiple values, which you need to receive (or call-with-values ...), here - pango-layout-get-pixel-extents - this obviously applies to any other 'similar situation (if an upstream function defines 'inout 'out args, then those are returned, after the function retrned value, in their upstream definition 'order' ... also see
<daviid> https://www.gnu.org/software/g-golf/manual/html_node/Customizing-G_002dGolf.html _ Strip Boolean Result for possible customization in certain circumstances ...
<sneek>Got it.
<daviid>sneek later tell akirakyle wrt your other question, it doesn't sound plausible to me that an upstream constructor would accept an empty array, but i can certainly improve the error message and/or fix it if you prove me wrong ... snipset please ... tx list is failing with "Invalid array argument:  ()"
<sneek>Okay.
<akirakyle>.
<sneek>Welcome back akirakyle, you have 2 messages!
<sneek>akirakyle, daviid says: wrt your pango-layout-get-pixel-extents, it returns multiple values, which you need to receive (or call-with-values ...), here - pango-layout-get-pixel-extents - this obviously applies to any other 'similar situation (if an upstream function defines 'inout 'out args, then those are returned, after the function retrned value, in their upstream definition 'order' ... also see
<sneek>akirakyle, daviid says: wrt your other question, it doesn't sound plausible to me that an upstream constructor would accept an empty array, but i can certainly improve the error message and/or fix it if you prove me wrong ... snipset please ... tx list is failing with "Invalid array argument:  ()"
<akirakyle>thanks sneek botsnack sneek
<akirakyle>daviid: Thanks, I was trying that but I think I got confused about the fact that the out args were structs and the only g-golf example with receive mixes it with allocate-c-struct. I've got it working just fine now
<akirakyle>daviid: Well the example that prompted this https://docs.gtk.org/gsk4/ctor.ContainerNode.new.html doesn't say in it's docs that the array can't be empty. And looking at the implementation, it handles being passed an empty array just fine https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gsk/gskrendernodeimpl.c#L2730
<akirakyle>daviid: Here's an example where I would expect it to work, but fails with "Invalid array argument:  ()" https://paste.sr.ht/~akyle/d89ef25a2fccc0521e41efe6751b88fc553bb764
<daviid>akirakyle: i'll fix it - why would you want to do that tough, i am curious
<akirakyle>daviid: When the set of render nodes are being generated dynamically, like with pango, sometimes there is nothing to render and so this makes it more convenient where I don't have a special case when nothing needs to be rendered, it'll just automatically "do the right thing" by creating a render node that's empty
<akirakyle>daviid: For concrete example, rendering the empty string, or rendering a string which has been marked up with a pango attribute to make it invisible
<daviid>but why not 'not calling append-node' then?
<akirakyle>The idea is that I'm building up some scene graph, so there is a root level node that I want to append to a snapshot, and there's a tree data structure in guile that represents the objects in the scene graph, some leafs may not have anything to render, so I want a "dummy" node that I can add to the scene graph rather than having to special case
<akirakyle>this scenario. Since the RenderNode is an abstract class, I think an empty container node is the only way to do that. This isn't difficult to work around by any means, just having such empty render nodes I think makes the code a bit cleaner
<akirakyle>daviid: Looking a bit more through the gtk source code though, maybe you're right and I should just avoid doing this all together
<akirakyle>daviid: Here's another example of a function that can accept a zero length array and do something sensible with it: https://docs.gtk.org/gdk4/ctor.ContentFormats.new.html
<akirakyle>daviid: in other places where the array should be nonzero, there's a g_return_val_if_fail call, and sometimes the array needs to even have more than one element in it so I think maybe it's best to let the called function complain if it's passed a zero length array and that's not sensible
<daviid>i will fix those cases, np, but i think you should flag your own guile tree nodes as renderer? (#t or #f), so parsing the tree 'knows' ... adding an empty <gsk-render-node> instance to a snapshot doesn't sound 'right' to me, and the sign of 'there are room for design improvment(s), i think ...
<akirakyle>daviid: Yeah I that's probably right as I'm reading more through the gsk code