IRC channel logs

2023-08-25.log

back to list of logs

<daviid>wrt to my yesterday quiz, fwiw, why 'make dist' was missing some files, it's because the default file name size limit is 99, and one has to specify an AM_INIT_AUTOMAKE option to raise that, tar-ustar for example ... fixed
<RhodiumToad>daviid: around?
<RhodiumToad>sneek, later tell daviid found the real bug causing those g-golf crashes
<sneek>Will do.
<RhodiumToad>sneek, later tell daviid the initialization of <gobject-class> is trying to set slot values before calling next-method, which doesn't work because the next-method will clobber them back to #f (from #:init-value)
<sneek>Will do.
<daviid>RhodiumToad: i am here - after i patched g-golf to fix the guile bug which prematurely gc's closures associated to the procedure->pointer, i haven't had a single bug anymore - not sure i understand why you think the above, as initialize <gobject-class> calls next-method 'before anything else' ?
<sneek>daviid, you have 2 messages!
<sneek>daviid, RhodiumToad says: found the real bug causing those g-golf crashes
<sneek>daviid, RhodiumToad says: the initialization of <gobject-class> is trying to set slot values before calling next-method, which doesn't work because the next-method will clobber them back to #f (from #:init-value)
<RhodiumToad>daviid: the change you made is not a real fix, it just hides the real problem
<RhodiumToad>you're calling (next-method stuff...) which evaluates stuff and _then_ calls next_method
<RhodiumToad>so any slot-set! inside the (stuff) will be done too early, before the #:init-value for the slots was performed
<RhodiumToad>so what was happening is that you stored the closure pointer in the slot, but then the parent's initialize method clobbered it to #f, so the closure is GC'd
<RhodiumToad>storing the closure in a global just stops it being GC'd, it doesn't actually result in the correct value being stored in the class slot
<daviid>RhodiumToad: ah ok
<daviid>i see now
<RhodiumToad>I admit it was not obvious to me without significant debugging effort :-)
<RhodiumToad>(hardware watchpoints are a wonderful thing)
<daviid>but the instance-init-func is a real fix though, because it is now a common code for all instanc and both a top-level for the closure and the procedure->pointer
<RhodiumToad>if you remove the class slot, sure
<daviid>RhodiumToad: i removed the instance-init-func, but i still have to fix what you pointed out nowe for the class-init-func ...
<daviid>will do that now -
<daviid>RhodiumToad: very good catch! my hat down to your skills .. and patience
<daviid>RhodiumToad: i pushed a fix (and did thank you in the commit, i also did thank you for your help in one of the previous fix as well) - let me know ... tx
<daviid>i could get rid of the class-init-func-closure slot now ... but no big deal either
<daviid>is there a way to retreive the value of an extern const using the ffi? for example extern const guint glib_major_version;
<wingo>zomg my rewrites to the pretty-printer are broke as a joke
<mwnaylor>After having problems w/ Racket and Chicken, decided to use Guile for personal scripting. I really like Clojure, but it can be a bit heavy for simple scripting. Looks like since they are both GNU projects, Guile and emacs will play well together. Planning to use Geiser for the repl. Any "gotchas" I should know about?
<mwnaylor>Only hiccup so far is that emacs info doesn't always find all the nodes in the Guile Reference.
<haugh>mwnaylor, it's a big system. What kind of problems were you having with Racket/Chicken?
<mwnaylor>haugh: Racket: ssl when trying to download and install packages via raco.
<mwnaylor>haugh: Chicken: I don't know how to get to documentation for packages/modules downloaded and istalled from eggs repository.
<mwnaylor>haugh: Chicken does not seem to play well w/ geiser.
<spk121>morning guile. I've read all the (ice-9 exception) docs and blogposts, and I'm still utterly mystified as to how to actually use them. How do I throw {"wrong-type-arg" in "func" in position #1, "arg" should have been string}?
<haugh>mwnaylor, package management in the GNU System is pretty much full Guix these days. When I first stumbled across Guix, I was confused because I couldn't delineate the macros from the procedures.
<morenonatural>mwnayler since you're using emacs, you should check out https://codeberg.org/rgherdt/scheme-lsp-server or https://gitlab.com/emacs-geiser/guile to improve info on symbols
<morenonatural>geiser is both a repl and a lib to provide a better IDE experience
<haugh>spk121, use define-exception-type to declare your wrong-type-arg exception type, initialize an exception using the constructor, and raise it with raise-exception
<morenonatural>emacs will use the current guile repl to do auto-completetion and fetch info on symbol-under-cursor
<mirai>what's the (ice-9 …) module “namespace” about?
<mwnaylor>haugh: Guess I'll have to look into Guix. How does it intregrate w/ the package manager on the host system?
<spk121>mirai: it is a very old joke. Someday we'll rename it to 'core' or something.
<mirai>what was the joke with ice-9?
<mirai>now that left me even more intrigued
<spk121>ice-9 was from a sci-fi story where it was a type of ice that converted everything it touched into ice. So it sort of saying that (ice-9 _) is where everything gets pulled into. Kurt Vonnegut, as I recall
<mwnaylor>spk121: Nice reference. I probably should look into KV in my local library catalog.
<haugh>Cat's Cradle!
<haugh>mwnaylor, guix /is/ a host system. You can also install it as a standalone package manager.
<haugh>recommend joining #guix
<jpoiret>mwnaylor: it doesn't interact with the package manager on the host system at all if you choose to install it on another distro
<jpoiret>it doesn't use the usual FHS directories so they shouldn't trample over each other
<mwnaylor>Does guix default to install in user directories or system directories?
<jpoiret>mwnaylor: if you know nix, it's the same idea, it doesn't "install" things to a single directory, each package has its own subdirectory in /gnu/store, and guix uses symlinks to activate stuff.
<rlb>spk121: you'll probably also end up making compound exceptions, i.e. to add a message, etc.. For example: https://codeberg.org/lokke/lokke/src/branch/main/mod/lokke/exception.scm#L124-L126
<spk121>rlb: thanks
<haugh>rlb, can you point to an example of "idiomatic" (in terms of (lokke exceptions)) control flow in lokke?
<rlb>Hmm, do you mean wrt scheme or clj? (...for guile/scheme lokke might or might not be a good example)
<haugh>I can see how that could be the case... uh okay I'm mostly struggling with this "basic constructor" concept. Can you broad-stroke it for me?
<haugh>I see a note here about the JVM, is it mostly to get along with that runtime?
<rlb>So you're mostly interested just in scheme/guile-proper? (Which is just fine, just checking :) ).
<haugh>Yes.
<rlb>OK, let me refresh for a minute (and with the caveat that I'm somewhat new to guile's new exceptions myself).
<haugh>This is an astonishing lib for someone new to exceptions, haha
<rlb>Well, it's iteration 2 -- used to use guile's old exceptions (it's also somewhat a hack/preliminary -- just made a bunch of decisions about mapping guile exception handling <-> clj exception handling, and we'll see how it goes).
<rlb>(if it goes)
<haugh>Ah yes, the ones in boot-9?
<haugh>Okay that makes a lot more sense
<rlb>OK, so yeah, make-basic-constructor, you can in part ignore. That's handling making clj/jvm-ish looking constructors for lokke exceptions.
<haugh>Thanks much!
<rlb>Right the prev (throw 'symbol ...) style vs guile 3.
<rlb>Also, I took some inspiration from how guile handles that paper-over/conversion itself (i.e. it converts old style to new style in some places).
<haugh>Yeah where it rexports itself into a new interface... it's very cool and scary
<rlb>See the "Constructor Summary" section here for some context if you're curious: https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Exception.html Though clojure/jvm itself only has limited "standardized" interaction with jvm exceptions.
<rlb>fwiw, for purely clojure code, the main focus is on "exception info" exceptions now, i.e. mostly the 4 functions starting here: https://clojure.github.io/clojure/clojure.core-api.html#clojure.core/ex-cause You basically just throw a map enclosed in a jvm ExceptionInfo. And clj code just deals with the map (and/or message).
<daviid>sneek: ice-9?
<sneek>I could be wrong, but ice-9 is "a nod to the fictional substance in Kurt Vonnegut's novel, Cat's Cradle, capable of acting as a seed crystal to crystallize the mass of software" <http://wingolog.org/archives/2009/01/07/a-brief-history-of-guile>
<ArneBab>I actually like ice-9 as a name a lot. It’s not trying to look too professional, and it gives a clear mission (that’s important).
<rlb>ACTION is somewhat fond of it as well, fwtw
<haugh>lol who programmed sneek to start with an acknowledgement of its fallibility
<haugh>great work
<rlb>I'm not sure I like our test harness treating a test as UNRESOLVED (and not causing the tests to fail) if the result is not #t or #f. Just realized I'd been overlooking some issues because I wasn't checking for *new* UNRESOLVED in the output.
<rlb>Think I might prefer if you just had to throw unresolved when that's what you mean (as it does internally).
<haugh>So I have this weird idea that an advantage of the "3.0 exceptions" (?) is the ability to accumulate excs as you unwind, composing them into an object which can be presented to your CI, logging, etc. The 6.13.8 (Exceptions) node in the Guile manual seems to indicate this kind of control hierarchy was part of the intent, but I don't really understand how to use with-exception-handler to accomplish it
<rlb>Depending on what you mean, lokke carries over the python and jvm idea of "suppressed" exceptions, and exception causes (i.e. what happens if you're in a close handler in a finally block with an exception already pending, and the attempt to close the file also throws?). It handles suppressed exceptions, for example, by adding a compound exception type &suppressed to accumulate the pending exception(s).
<haugh>Do you write this kind of handler at the top level, supporting many types, and then install it at important control points, or do you write ad-hoc handlers for only the types you expect them to encounter?
<rlb>And I don't know if this is germane, and even if it is, whether it might have too much distracting clj-oriented stuff, but possibly related: https://codeberg.org/lokke/lokke/src/branch/main/mod/lokke/exception.scm#L188-L199
<haugh>I'm sorry I get filtered so hard by the JVM. Not having to use JVM was a major factor in my choice to pick a Scheme impl.
<rlb>In lokke's case, it's wired in to the clj try/catch/finally, so it's ubiquitous for the cases that support it.
<haugh>rlb, in that snippet, when would EX be false?
<rlb>No worries, I used to be a lot harder on the jvm myself, but I've quite enjoyed clojure. (Plenty to learn from it, though.)
<rlb>iirc, whenever there's a pending exception. Some context here if it helps (i.e. I think that'd be true in the finally block in the first example): https://codeberg.org/lokke/lokke/src/branch/main#exception-suppression
<rlb>But I'd have to refresh my memory wrt that code to be sure.
<dthompson>haugh: if I'm reading you correctly, yes I agree that this is an advantage of the new exception system. spritely goblins does this, actually, to decorate arbitary exceptions with additional contextual information.
<dsmith>haugh, There are some ransom prefixes that the but uses. Inherited from the old sarahbot that used to inhabit #scheme years ago.
<dsmith>s/ransom/random/
<dsmith>s/but/bot/
<dsmith>Sheesh
<dsmith>sneek, botsnack
<sneek>:)
<dsmith>Goodbot
<sneek>ACTION wags
<rlb>Pushed a notable update to the utf8 branch - should substantially increase non-ASCII test coverage (WIP) and fix some bugs revealed thereby...
<rlb>More confident in it now.
<haugh>Ooookay I had missed #:unwind-for-type
<rlb>wingo: ^ ...and I raised the PR you suggested for commentary: https://codeberg.org/rlb/guile-utf8-tmp/pulls/1 As mentioned, if you'd prefer something else / somewhere else, just let me know, and at the moment, my main interest would be whether or not it seems remotely plausible, i.e. something I should continue pursuing.
<rlb>haugh: ahh, right.
<haugh>thanks rlb and dthompson for the very interesting code recommendations
<rlb>wingo: oh, and of course I'm likely quite flexible about any/all the details - just made a "bunch of decisions" as I went, some notably bigger than others.
<rlb>Any suggestions for additional, initial string performance tests I might run? ("make -j5 check" here didn't really change, fwiw) Ideally to start, ones without a lot of extra dependencies, and that don't rely to heavily on any C internals (scm_i_string_*, etc.).
<RhodiumToad>daviid: did you find dynamic-pointer?
<daviid>this is in libguile? and deprecated? i am about to write a few functions to get those in libg-golf and in g-golf using the ffi
<RhodiumToad>who said it's deprecated?
<daviid>a ./libguile/dynl.c comment
<RhodiumToad>(pointer->bytevector (dynamic-pointer "glib_minor_version" (dynamic-link "libglib-2.0")) 1 0 'u32) ;; for me this returns #u32(76)
<daviid>ok great
<RhodiumToad>dynamic-pointer is low-level in the sense that it's just returning the dlsym() result as a pointer and it's up to you to figure out what to do about it
<daviid>RhodiumToad: i'll use that thanks
<RhodiumToad>(and yes, the version of glib installed on my system is indeed 2.76)
<daviid>the problem is GLib, unlike all other GNOME lib, doesn't provide 3 functions to retreive those, and maintains 2 sets of values, one releated to what they call the 'header' values, and one set called the 'runtime' values - GI lets you import the so called 'header values', https://paste.centos.org/view/1a0d9b31 - but not the 'runtime' set, which is the one i want users to report if they face a prolem ...
<RhodiumToad>the "header" values end up in the typelib?
<daviid>RhodiumToad: i'll use the ffi as you suggested, i am always reluctant to 'have to' grow libg-golf ... tx
<daviid>those are the only one available using GI, if that is what you are asking, see the paste here above
<RhodiumToad>right
<RhodiumToad>so yeah, use the dynamic-pointer approach to get the actual values from the .so
<daviid>ok, i need the runtime values ... hence i was looking for 'an ffi way to do so ...'
<daviid>will do, tx