IRC channel logs
2023-02-28.log
back to list of logs
<lechner>daviid / sorry i offended you with my question, and thanks for the advice! <winter>i can't find that in the reference manual :D <winter>is there some reference of common idioms, e.g. when % is used for variables, or the `?` suffix for variables/functions (well that one's obvious but) <winter>(dropped the question mark, oops -- that is a question :p) <lilyp>% means 'internal, do not touch unless you know what you're doing' <pinoaffe>daviid: in the guile compiler tower, there's a definition for "scheme" (the default language for guile). When defining a language, you can specify how two AST's can be "merged" into one AST - no such function is specified in the definitino of scheme <pinoaffe>I was wondering whether there's a specific reason that no such joiner is specified, even though there's a natural option, namely (lambda (stmts env) (cons 'begin stmts)) <lloda>i think it's well explained, but it'd be nice to have some examples <lloda>you set up the handler at A, go down some calls, raise at B. If you don't unwind, you continue from B. Unwind means to go up those calls to continue from A. <gtz>Here when "unwind" is false a backtrace is printed when running the program whereas if "unwind" is true no backtrace is printed. Nothing is mentioned about that in the docs <lloda>it's mentioned in the description of raise-exception <lloda>you didn't set #:continuable? <gtz>I didn't set "#:continuable?" <lloda>you wrote (raise-exception 123), if you write (raise-exception 123 #:continuable? #t) then the routine will continue to (display 'after) after the handler <lloda>tbh i couldn't say why the defaults are what they are, when they aren't then the interface sure is cumbersome <winter><lilyp> % means 'internal, do not touch unless you know what you're doing' <-- are idioms like this actually documented anywhere (not even in e.g. reference manuals i mean), though? like, where would someone figure that out if not by asking? <lilyp>it's not per se documented in the Guile manual, but well established practise among multiple Schemes if not Lisp as a whole <lilyp>It's kinda like asking "why do you name your ints i and j?" <lilyp>you get this through cultural osmosis <wingo>doesn't civodul use % sometimes to mean a global variable or something <dthompson>as opposed to *foo* for a top-level mutable thing <wingo>but i think maybe in more recent years the assumption was that top-level definitions were immutable / constants, no need to mark them as such <dthompson>yeah I think the convention has some catching up to do :) <dthompson>I still do the same thing since I read a lot of guix code back in the day. <wingo>the other funny thing about % meaning 'internal' is that it's pronounced "sys" <wingo>and that translates to guile C api, conventionally that %foo would be sys_foo (or scm_sys_foo) <mwette>If top-levels should be constants, would it be a good thing to promote make-box and associates to the (guile) module? <lechner>cwebber / Hi, can syrup next its own records? <sneek>I could be wrong, but naming is an important but difficult topic, as we've seen <wingo>mwette: make-variable and variable-ref are there <wingo>but i like the name "box" better :) <rekado>isn’t & the sigil for exception types…? <dthompson>on the subject of boxes, atomic boxes rule. one of those "I never knew how much I needed this" kind of things. <lechner>cwebber / yeah, my issue is elsewhere. sorry. Having dealt with JSON encoding issues for years, i am super enthusiastic about Syrup but my Guile skills are wanting <cwebber>lechner: yes for both the label and the values <cwebber>any container syrup structure can contain any other syrup structure <lechner>cwebber / thanks, i expected nothing less. if it's not too much trouble, have you seen this error before. i promise i won't trouble you with the intricacies of my code "syrup.scm:199:10: In procedure bv-length: Wrong type argument in position 1 (expecting bytevector): #<unspecified>" <cwebber>lechner: it may be that this is a bug from using the older syrup code... try it with (goblins contrib syrup) <cwebber>sorry :( we have bugfixes in there that haven't gotten to the main structure <mwette>glad to have atomic-boxes ; but for single threaded srfi-111 boxes are nice and simple <dthompson>atomic boxes have been super handy in spritely land where we are dealing with communicating event loops running in separate threads. <lechner>cwebber / okay, thanks! that's working now. <cwebber>this happened in expediency of trying to focus on knocking out guile-goblins <cwebber>but that's kinda on tsyesika's queue ;) <lechner>cwebber / by the way, (goblins contrib syrup) pulls in (goblins ghash) and then (goblins core) <tsyesika>yeah I'm currently working hard on syrup stuff! including bringing the fixes we've made in our checked in version of syrup to the upstream project and then having it be an external dependency for goblins rather than our own checked in copy <lechner>tsyesika / a simple cp would do! (plus drop ghash) <cwebber>lechner: it can be cp'ed, but also the right solution is to make it so that all the hash related procedures can be swapped out as keyword arguments <cwebber>we have to use ghash for A Reason in goblins <cwebber>lechner: this literally came up in the engineering call last week at sprittely <cwebber>lechner: if you want to help on this, patches are indeed welcome <cwebber>and tsyesika is becoming the secondmost syrup expert ;) <dthompson>I had syrup on my french toast this morning so I'm third expert <cwebber>we're not even sure if it's staying in that repo <cwebber>but the thing to absorb is that yes, we're syrup-minded at the moment internally :) <cwebber>just wait till y'all see what dthompson is up to, holy moly <tsyesika>yeah, I think maybe we should move it to the main syrup repo and it can live along side the test data I'm making :) <cwebber>tsyesika: I think you should just make a branch in that repo <lechner>tsyesika / cwebber / a cursory review of the Goblins repo suggests that the 0.10 version in Guix shipped with the working syrup.scm. Is that right?\ <cwebber>spritely is up to a lot of cool stuff right now <cwebber>I look forward to posting our next few updates <cwebber>that includes the WASM stuff which is already moving forward fast thanks to wingo <cwebber>it'll make it easier for people to try it <tsyesika>okay I'm heading off for the evening :) cya folks! <lechner>cwebber / i agree and likewise think you should spend your time on WASM etc. finally someone is implementing Brendan Eich's original vision for JavaScript <mwette>In calling scm_ functions from C, can I pass SCM_UNSPECIFIED to indicate unspecified optional argument (tested with SCM_UNBNDP)? <mwette>that is, SCM_UNSPECIFIED as arg typed for SCM <dthompson>drakonis: yeah because it's a real hoot that guile is going run in the browser <stis>Freedom of speech is deer to me, but with the right set of rules, here is my approach in a currentlu live document that may change depending on what I learn <stis>The fun thing is that in order to make the idea transparent I try domodel the logic in prolog :-) maybe we can make one version in minikanren as well <lechner>Hi, how may I reliably convert a filename, which is a string in Guile, to a bytevector please? The procedure string->bytevector fails whenever the actual encoding of the filename (which is not known to me) is different from the encoding I specify as a second argument. Thanks! <mwette>When I was a kid I watched The Jetsons (cartoon). The main character George Jetson worked for Spritely Sprockets (IIRC). I wonder if spritely has any sprockets. <daviid>string->pointer accepts an optional encoding arg iirc <daviid>i wonder if, starting with guile 3.0, string->pointer with no optional arg returns a utf8 encoded string (?) <lechner>thanks, but with all that decoding, how does guile ensure over all possible bytestrings that the file being written is also the one that was read? <gtz_>Is there a way to print a traceback? I want to capture an exception, log it and continue. <old>gtz_: (print-exception (current-error-port) #f (exception-kind exception) (exception-args exception)) <graywolf>Is it possible to redefine record type? I have a module with a record (using guix' define-record-type*) and I would like to redefine it in my own file (after (use-modules ...)) in order to add additional field. Is that possible? <mwette>Do you mean extend a record type? If base record is A and your extended record is B do you want (A? (make-B)) and (B? (make-B)) to both return #t? <graywolf>Hm, probably? Ideally I would like to be able to "monkey patch" two definitions (one is the record type, one is define) in a module I am (use-modules)-ing. <graywolf>I wanted to just copy paste it and since the record already exists, it seems to fail when I try to define it again (under the same name) <mwette>Look at code for srfi/srfi-9 and make-struct/simple (or make-struct/no-tail) and struct-vtable in the ref manual. It could be done, but not simple, IMO. <mwette>^ code for srfi-9, documentation for make-struct/no-tail <graywolf>Hm, thanks for the pointers, but that somehow looks like something I very much do not want to do :) I think I'll just copy&paste the relevant parts I guess. <mwette>A better/cleaner way would be to define a record B with record A a member and define getters/setters for recA fields like (define (recB-fld1-ref B) (recA-fld1-ref (recB-fldA-ref B))) <lloda>every time you define a record type it's a new type, the name doesn't matter, even if the definition is completely identical. That's why it's better to put record definitions in their own modules, so you can reload modules that use the records without redefining the record as a side effect <lloda>i think there's a kind of record that doesn't behave like that, but the details escape me atm <mwette>So, with the WASM port, will records be implemented "100%" in Scheme (e.g., on top of vectors) <dthompson>mwette: there will be a primitive struct type implemented directly in wasm <dthompson>the current state of these type examples say that structs with more than 4 fields will have field 5+ stored in a scheme vector. <lechner>tsyesika / Hi, sorry to bother you with a trifle. How do I get values out of the ghash table that is the integral part of the syrec record in (goblins contrib syrup), please? (I'm a Guile newbie.) Thanks! <tsyesika>inside (goblins ghash) there's a function ghash-ref where you can provide a key and it'll return the value if it exists <lechner>tsyesika / is there a direct accessors (similar to guile-json) that operates on the syrec record itself? <tsyesika>oh I think I misunderstood. you have a syrec and you want to access the values? <tsyesika>syrec's are just srfi-9 records, there's a syrec-label accessor for the label and syrec-args for the arguments <tsyesika>you can also use record patten matching to extract them <lechner>tsyesika / part of the problem is that my Guile skills are developing. is there an example in the Goblin source tree? <tsyesika>as I mentioned you can always use `(syrec-args <syrup-record-here>)` if it's a more simple case <lechner>tsyesika / thanks! i am so helpless. what's the '$' please? <tsyesika>you can see it shows matching on a record type ($ record-name pat_1 ... pat_n) <haugh>Hello. I don't understand how to use (system vm trace). In particular, I can't get trace-calls-to-procedure to print anything in a REPL or otherwise, and I don't understand the application of the procedure it returns. Anyone have working code? <haugh>I just right now realized I might need to manually increase the trace "level" (not sure about the term) <wingo>you might look at what ,tracepoint does under the hood <wingo>scheme@(guile-user)> (define (inc x) (1+ x)) <wingo>scheme@(guile-user)> ,tracepoint inc <wingo>Trap 0: Tracepoint at #<procedure inc (x)>. <wingo>scheme@(guile-user)> (map inc (iota 10)) <wingo>uses add-trace-at-procedure-call! from (system vm trap-state) <wingo>traps are a pretty weird interface :P <haugh>Wasn't there supposed to be some kind of "how to debug Guile" summit? Did that happen? I'd like to know more about how to debug Guile :) <civodul>haugh: not a summit, but there was a session on this topic at the Guix Days before FOSDEM <haugh>ooh, thanks I'll check it out <civodul>i think jgart[m] wanted to organize some online meetup on this topic tho! <dthompson>probably my biggest annoyance with debugging guile is when backtrace printing throws an exception. <haugh>dthompson that's exactly why I'm doing this right now :) <dthompson>it's always in some difficult to reproduce situation but it's so frustrating <flatwhatson>sneek: later tell dthompson There were some crashes in stack printing due to malformed frames that were fixed in 3.0.9, if you're seeing more like this let me know, I'll be happy to dig into it. <lechner>Hi, would someone please point me to an example on how to use record matching? I would like to use it to access fields in 'syrup' records, which is a serialization format. there are some more details in the backlog <flatwhatson>((and binding ($ <binding> frame idx name slot)) . bindings) <flatwhatson>matching a list of "binding" records, storing the first as "binding" and also destructuring its fields into frame/idx/name/slot <flatwhatson>hmm, looks like syrec is just label and args, where args is a hash table <flatwhatson>so ($ <syrec> label args) to destructure the record, then (hash-ref args 'relative-path) <flatwhatson>there's no hash-table destructring in ice-9 match, but you *could* cobble something together with (= field ...) or (? predicate ...) <flatwhatson>ah, so args is not necessarily a hash-table then. in your pasted example, it's a hash table, but in this user-record destructring, it's a list <flatwhatson>hrrm, so your args are actually a list ("A single store item" #<hash-table ...>) <flatwhatson>right, i guess a syrec can store anything, it's up to you to pick a representation that's most convenient. for the captp implementation, they're using a simple structure that's easy to destructure <lechner>okay, thank you. that makes me feel better. i am in a little bit over my head with what i am trying to do in scheme. it's extremely painful to make baby steps again, but so far things ended up working well. i just wish i hadn't spent some much time with Perl <flatwhatson>I spent many years working in Perl, I don't think it causes permanent brain damage. <lechner>actually, some of Perl's list functions got me excited about Scheme, with a detour through Haskell <flatwhatson>right, there's lots of higher-order goodness available in perl <flatwhatson>scheme can be concise without *cheating* by using obscure syntax operators (ok, ignoring match maybe) <flatwhatson>lechner: are you in charge of this "store-item" record structure? or working with some existing API? <flatwhatson>your example uses a bytevector as the label, where the spritely example they're using a symbol. symbols are much easier to match than bytevectors. <lechner>flatwhatson / yeah, completely in charge. it's the upload format for juix.org <lechner>i went with that really old example. plus, i don't really know what i am doing <flatwhatson>lechner: i'm not really familiar with syrup, but can't see any define-syrup-type macro which would do something similar to define-json-type <lechner>flatwhatson / thank you so much for your help today! <lechner>tsyesika / Hi, does syrup require the use of (goblins ghash) as a hash-table engine, please? In which way is it superior to the standard Guile implementations provided by (ice-9 hash-table) or (srfi srfi-69)? <lechner>i do not seem to be able to use hash-table-ref on #<ghash> <lechner>this is on reading. i use regular hash-tables before encoding, but the decoded records after transmission contain (goblins ghash) records <dthompson>lechner: the current implementation in goblins is hardcoded for ghashes but it will be made generic soon. <sneek>Welcome back dthompson, you have 1 message! <sneek>dthompson, flatwhatson says: There were some crashes in stack printing due to malformed frames that were fixed in 3.0.9, if you're seeing more like this let me know, I'll be happy to dig into it. <dthompson>lechner: ghashes are based on guile's vhash functional hash table and they are specialized for some goblins-specific stuff. <lechner>dthompson / okay, thanks! luckily, it's on the receiver side only, so i can release my client tools and change the database importer later <cow_2001>what's the most straightforward way of drawing stuff in guile? simple 2d graphics with simple procedures? <cow_2001>i'm new to guix. no clue what's it i'm doing with the environment variables <cow_2001>it's currently guix installing guile-chickadee <cow_2001>oh, it was, now it's doing the same for picture language <cow_2001>not sure if i should or shouldn't add both ~/.config/guix/bin and ~/.guix-profile/bin to the PATH <cow_2001>or do i somehow go into the .guix-profile environment as if it was some virtualenv? <cow_2001>config one is for the home guix, second is for everything else installed by guix, right? <cow_2001>this is all amazing. i'm so excited with this guix business. <rekado>a counter-weight for these enormously buldging eyes <mwette>The last time I left off on digging into debugging, I was looking how to add more info to meta in (language tree-il compile-bytecode) to be able to incorporate into dies in (system vm assembler). I was looking to add references for boxed locals to start. <abcdw>dthompson: Is there a guile lib for parsing org-files, to write posts for haunt in org instead of md/html/skribe? <dthompson>you'll have to check out the release tarball because this page links to the long defunct gitorious <dthompson>maybe someone could snarf that and create a guile-org project with it? <dthompson>I'd be happy to add such a thing as an optional dependency to haunt! <jpoiret>abcdw: the problem is that org-mode is a moving target, there's no spec, it's just whatever emacs decides to implement <daviid>oh, no logs for march ... i wanted to grab this org-mode converation .. i lost my connection earlier today, for a litle while ... <civodul>dthompson: +1 on snarfing the Org parser and creating guile-org! <civodul>though i agree with jpoiret, it's very much a moving target, so that'll only ever parse a subset of Org <dthompson>there's parts of the org format that haven't really changed in a long time <BrokenClutch>Is it possible to draw stuff with cairo using g-golf gtk stuff? <BrokenClutch>daviid: Thanks, is there an example of that? I'm trying to do it for days (I'm being dramatic) <daviid>BrokenClutch: though it doesn't have a cairo specific example (yet), you should be able to 'pick' a gtk4-demo (or other) example and 'port it' to g-golf <daviid>BrokenClutch: i can't promise i will find the time, but i'll try - is your example based on a public gtk4 or other code demo? <BrokenClutch>daviid: an old stuff that I've made long time ago, but don't worry, I will port something cool to g-golf, maybe I'm gonna be the one to make the g-golf cairo example :D <daviid>BrokenClutch: try to do something 'dead simple' first, just read the gtk4-demo 'Paint' example source code, and make sure you understanbd how a cairo surface is (must be) 'handled' by gtk4 - i'll see if i can myself cook something, but i am quite busy at the moment ... <BrokenClutch>daviid: Don't need too, I have the time to work it out. I will try the paint one. <daviid>BrokenClutch: actually, the 'Simple Paintable' is easier to start with <daviid>BrokenClutch: in order to acheive te port, you need to subclass GObject and define a snapshot vfunc - for those steps, look at the peg-solitaire g-golf example <daviid>BrokenClutch: after the 'Simple Paintable', look at the gtk4-demo "Animated Paintable' <daviid>BrokenClutch: oh definitely, if you're not familiar, first read a tutorial, here is a good one <BrokenClutch>thanks, going to take a read, this will take time, but I like guile a lot <daviid>BrokenClutch: then read the peg-solitaire example, together with the g-golf doc, the uer manual, that is II. Using G-Golf [all section, but you may skip 'Working with GNOME' , then jump to continue reading 'G-Golf Valley' - you definitely do _not_ have to read the III. G-Golf Core Reference, which is for g-golf contributors <BrokenClutch>daviid: ok, I'm going to go away rn because my health isn't great, good day for you all, thanks for the help <daviid>BrokenClutch: you may ask any question here, this channel a few goops wizards always happy to help - <manumanumanu>mwette: regarding srfi-166: it is extensible, but everything will be more verbose than format strings <manumanumanu>sorry about the delay, but i use my computer about once every week. <manumanumanu>mwette: like (show #f "Here I have a hex number: " (my-hex-fmt var) ". The end"). So for simple cases it is not much better than (display stuff), but if you wish to start doing padding or column formatting it is dang handy.