IRC channel logs

2020-07-22.log

back to list of logs

***drakonis1 is now known as drakonis
<dsmith>Isn't nginx supposed to be to latest hotness?
<pkill9>yes
<chrislck>alextee[m]: zrythm is super impressive
<alextee[m]>chrislck: thx. I hope I can figure out more ways to use guile
***catonano_ is now known as catonano
<daviid>str1ngs: are you using multiple inheritance in nomad? maybe you told me but i forgot ...
***wxie1 is now known as wxie
***d4ryus1 is now known as d4ryus
***terpri__ is now known as terpri
<str1ngs>davidl: I know for sure with emacsy I have some multiple inheritance. Maybe with g-golf but I can't recall off hand for sure. If it's important I can double check for you?
<str1ngs>davidl: also g-golf is updated to version: 1-804.5d2903a now in guix. so if anyone needs the latest with guix just make sure they guix pull.
<str1ngs>sneek: later tell daviid I know for sure with emacsy I have some multiple inheritance. Maybe with g-golf but I can't recall off hand for sure. If it's important I can double check for you?
<sneek>Okay.
<str1ngs>sneek: later tell daviid also g-golf is updated to version: 1-804.5d2903a now in guix. so if anyone needs the latest with guix just make sure they guix pull.
<sneek>Got it.
<str1ngs>davidl: sorry for the noise that was meant for daviid :)
<str1ngs>sneek: later tell daviid though for g-golf I would not use something like. (define-class text-widget (gtk-text-view gtk-box)) since multiple inheritance is not supported by GTK. hopefully I understood your question right.
<sneek>Got it.
<dsmith-work>Wednesday Greetings, Guilers
<roelj>Is there an equivalent “add-to-load-path” for the %load-compiled-path?
<pkill9>roelj: i can't find anything here https://www.gnu.org/software/guile/manual/html_node/Load-Paths.html
<pkill9>it mention %load-compiled-path
<dsmith-work>pkill9: Nope. You need to do what add-to-load-path is doing. Look in boot-9.scm
<dsmith-work>There is also the -C option to guile
<dsmith-work>Interesting they made that syntax..
*pkill9 wants to make a guile web scraper
<roelj>Okay, thanks
<pkill9>how can you search recursively for <identifier> in (<identifier> . <value>)?
<pkill9>guile-json produces those pairs for keys
<pkill9>hmm actually i wouldn't need to do that
<pkill9>because I already know the structure of the data
<chrislck>pkill9: are you working with nested-alists?
<pkill9>im working with nested lists, not sure what an alist vs a list is though
<pkill9>argh, im able to ping the domain, yet guile keeps saying 'name or service not known'
<pkill9>yes, alists are what they are
<pkill9>(key . value)
<chrislck>feel free to copy from https://github.com/Gnucash/gnucash/blob/master/gnucash/report/html-chart.scm#L47
<mwette>pkill9: check the tree-fold routines in (sxml fold)
<mwette>pkill9: https://wingolog.org/pub/fold-and-xml-transformation.pdf
<roelj>When I want to conditionally add an attribute in sxml (like this: (sxml->xml `(input (@ ,(if #f `(checked "") '()))))..). What can I put in the place of the empty list to let sxml->xml NOT include it in its XML representation?
<chrislck>roelj: check ,@
<chrislck>,@ is the bully equivalent of , -- it takes more than 1 space on the bus
<chrislck>,@ is the bully equivalent of , -- it takes as much space as it wants
<dsmith-work>heh
<dsmith-work>Takes your lunch too?
<pkill9>i'm constantly getting this: In procedure getaddrinfo: Name or service not known
<chrislck>:)
<pkill9>but i can ping and access the website
<roelj>chrislck: This is exactly what I was looking for, thanks!
<mwette>roelj: use . : (@ . ,(if #f `((checked "")) '()))
<roelj>mwette: Why The "."?
<dsmith-work>pkill9: So what does that suggest? You are using getaddrinfo differently than ping, or maybe ping isn't using get addrinfo?
<mwette>the difference is (list '@ '()) vs (cons '@ '())
<heisenberg-25>Hi, why is the getaffinity procedure not available on non-linux systems? running (getaffinity 0) on ubuntu succeeds but fails for Mac OSx. Is there a work around
<mwette>and (cons '@ '()) => '(@)
<heisenberg-25>or is there some flag that I should compile guile with to make it work?
<mwette>heisenberg-25: hybridkernel.com/2015/01/18/binding_threads_to_cores_osx.html
<pkill9>dsmith-work: (web client) is using getaddrinfo
<heisenberg-25>mwette: Thank you, this really helps. I will post question if I run into an obstacle :)
<dsmith-work>That reminds me. What does it take to use https with the (web client) ?
<pkill9>how can I deal with unsupported characters in text that gets passed to guile-json
<pkill9>i want to just replace all non-supported characters in a string basically
<pkill9>the json parser passes some text to integer->char, and then an error: json/parser.scm:249:2: In procedure read-control-char:
<pkill9>In procedure integer->char: Argument 1 out of range:
<pkill9>55358
<pkill9>55358 i believe is a hugging emoji, lol
<RhodiumToad>no its not
<RhodiumToad>55358 = U+D83E, which is a high surrogate, and therefore not a valid character
<RhodiumToad>I believe json encodes surrogate pairs separately? so you might have to fetch both parts of the pair and convert them together
<RhodiumToad>U+D83E could be the first half of U+1F917, which would encode as U+D83E U+DD17
<RhodiumToad>i.e. "\uD83E\uDD17" in json
<RhodiumToad>(U+1F917 == hugging face emoji)
<dsmith-work>So that's a bug in guile-json?
<RhodiumToad>if it's trying to decode \uXXXX independently when the value is a surrogate, yes
<dsmith-work>Ugh.
<RhodiumToad>(it's kind of ick that json uses that encoding in the first place...)
<RhodiumToad>haha. "strictly complies to http://json.org specification".
<RhodiumToad>anyway, yes, definite bug in guile-json.
<pkill9>guix's guile-json is 3 stable versions out of date, so it may have been fixed, i'll see
<RhodiumToad>I was looking at what was on savannah
<RhodiumToad> http://git.savannah.nongnu.org/cgit/guile-json.git/tree/json/parser.scm#n275
<holomorph>what happened to ice-9 json
<RhodiumToad>it is not correct that "Characters in Guile match the JSON representation" so that breaks
<RhodiumToad>I guess the fix should be to read 4 hex digits, and if the value is in DC00-DFFF throw error, if it's D800-DBFF then read in an immediately following \uXXXX and error if that isn't DC00-DFFF
<minerjoe>Need some help, please. Tried google, no avail. How do you get guile to output unicode characters?
<minerjoe>(integer->char 8308)
<minerjoe>#\20164
<minerjoe>(char->formal-name #\20164)
<minerjoe>"SUPERSCRIPT FOUR"
<minerjoe>(dispay #\20164)
<minerjoe>?
<minerjoe>This is under geiser in emacs.
<RhodiumToad>(display (integer->char 8308)) works for me in shell
<RhodiumToad>possibly something isn't configured to handle utf8?
<minerjoe>Yea. Just tried shell and it works.
<minerjoe>Hmm.
<dsmith-work>Locale settings?
<daviid>.
<sneek>Welcome back daviid, you have 3 messages!
<sneek>daviid, str1ngs says: I know for sure with emacsy I have some multiple inheritance. Maybe with g-golf but I can't recall off hand for sure. If it's important I can double check for you?
<sneek>daviid, str1ngs says: also g-golf is updated to version: 1-804.5d2903a now in guix. so if anyone needs the latest with guix just make sure they guix pull.
<sneek>daviid, str1ngs says: though for g-golf I would not use something like. (define-class text-widget (gtk-text-view gtk-box)) since multiple inheritance is not supported by GTK. hopefully I understood your question right.
<minerjoe>The problem isn't actually in geiser. I have a web app and am trying to output sxml. Using (format #t "~A" #\20164) give "?".
<RhodiumToad>that also works for me
<RhodiumToad>what sxml function did you use?
<daviid>str1ngs: i was just being curious - you may use multiple inheritance in g-golf
<minerjoe>RhodiumToad: I'm just generating lists with quasiquote. Using format to generate strings. Is there a way to tell guile not to use "?" but the real thing?
<dsmith-work>minerjoe: Pretty sure guile uses ? when it doesn't know how to encode the charcter.
<RhodiumToad>yeah, this is a problem with encoding translation
<minerjoe>dsmith-work: I'm new to guile, old common lisp programmer, just figuring things out. This would be something related to "ports"?
<RhodiumToad>(sxml->xml `(foo ,(format #f "~A" #\20164))) for example works perfectly for me
<dsmith-work>
<dsmith-work>IS that what it is?
<minerjoe>And I'd like to fix the geiser<->emacs so that it works at the REPL also.
<minerjoe>dsmith-work: yes
<RhodiumToad>superscript-4 is the character, yes
<minerjoe>Does anyone here have emacs+geiser that correctly displays unicode?
<dsmith-work>Works for me. Guile 3.0.4 (format #t "~A" #\20164)
<minerjoe>dsmith-work: in geiser+emacs?
<RhodiumToad>minerjoe: what does (port-encoding (current-output-port)) return?
<minerjoe>
<minerjoe>$10 = "ANSI_X3.4-1968"
<RhodiumToad>right. that's the problem then.
<RhodiumToad>should be "UTF-8"
<dsmith-work>Yep. Works the same.
<RhodiumToad>for whatever reason, likely to do with your LANG / LC_* environment vars, the output port encoding is wrong
<dsmith-work>minerjoe: WHat verison guile?
<minerjoe>
<minerjoe>(set-port-encoding! (current-output-port) "UTF-8")
<minerjoe>This works!
<minerjoe>dsmith-work: 3.0.4
<minerjoe>Thank you!
<minerjoe>I'm pretty sure I can figure out how to get the web-server to now output.
<minerjoe>correctly
<RhodiumToad>it'll be picking up the default for that encoding from LANG or LC_*
<minerjoe>RhodiumToad: well my LANG=LANG=en_US.UTF-8
<minerjoe>RhodiumToad: well my LANG=en_US.UTF-8
<RhodiumToad>and LC_CTYPE?
<minerjoe>RhodiumToad: not set
<RhodiumToad>output of (system "locale") might be useful
<minerjoe>student@black ~ % locale
<minerjoe>student@black ~ % locale
<RhodiumToad>uh?
<minerjoe>Eh. pasting failing. Probably ok. All en_US.UTF-8
<RhodiumToad>and locale charmap also returns UTF-8 ?
<dsmith-work>sneek: paste?
<sneek>I could be wrong, but paste is https://paste.debian.net
<dsmith-work>minerjoe: Could the environment for your shell and your web server be different?
<RhodiumToad>almost certainly will be
<minerjoe>Na. I just ran (system "locale") at the start of the app and it's all en_US.UTF-8
<minerjoe>I'll investigate. I can just force it.
<RhodiumToad>if the current output port isn't the default one for guile's stdout, then whatever created it might be setting the encoding
<minerjoe>RhodiumToad: yes local charmap = UTF-8
<RhodiumToad>aren't charsets fun
<minerjoe>Do you know what port is used for (format #f ...) ?
<dsmith-work>Things were a lot simpler back when everything was just american english. Bytes were Chars and Chars were Bytes...
<dsmith-work>That makes a string port, right?
<minerjoe>dsmith-work: I think. But don't know how to set the encoding?
<RhodiumToad>format #f just returns a string
<dsmith-work>Calls (open-output-string)
<RhodiumToad>so there's no encoding issue with that
<minerjoe>My (format #f) gives the "?"
<minerjoe>investigating
<RhodiumToad>no, it's when the result returned by the format #f is being displayed that it gets changed to ?
<minerjoe> That makes sense.
<dsmith-work>Ok.
<heisenberg-25>is using scm_without_guile really worth it? The doc says it provides small optimization for the GC but is it worth the extra line of codes and adding wake pipes?
<RhodiumToad>i.e. (eq? (string-ref (format #f "~A" #\20164) 0) #\20164) should be #t unconditionally, regardless of any encoding settings
<RhodiumToad>er, should probably be eqv?
<RhodiumToad>though in guile eq? will work too
<dsmith-work>Ah. Yes, guile strings can be "wide".
*dsmith-work has been doing lots of Rust lately..
<minerjoe>RhodiumToad: I've narrowed down the problem to scm_to_locale_string, which is converting the guile string into the C string that the web-server is serving. Any idea how to set the locale for that?
<minerjoe>Apologies if this is a RTFM.
<RhodiumToad>the "current locale"
<RhodiumToad>is this guile embedded in something, or the guile REPL binary?
<minerjoe>Its embedded.
<RhodiumToad>ah. so it's possible that the environment didn't do setlocale, and is therefore in C locale.
<pkill9>i tested latest stable guile-json and it still fails with the error i was talking about, gonna report bug
<RhodiumToad>what does (setlocale LC_CTYPE) return in the embedded environment?
<minerjoe>RhodiumToad: will see
<minerjoe>RhodiumToad: That works! Thanks! I just added setlocale(LC_CTYPE, "en_US.utf-8") to the main() and we're off and running.
<minerjoe>And geiser is now working with unicode also.
<RhodiumToad>note that setlocale(LC_ALL,""); is the more standard way
<minerjoe>RhodiumToad: Ok. I'll see if that works.
<RhodiumToad>you don't want LC_CTYPE set differently to the other locale settings in general.
<RhodiumToad>the default if setlocale is not called is equivalent to setlocale(LC_ALL,"C"); using "" means "read the LANG and LC_* environment variables"
<dsmith-work>The guile exe does setlocale(LC_ALL, "")
<dsmith-work>(depending on the value of env var GUILE_INSTALL_LOCALE)
<RhodiumToad>right. The snag from the point of view of embedded usage is that the locale set by setlocale() affects the whole process, sometimes in unexpected and very bad ways
<dsmith-work>That happens *before* guile calls scm_boot_guile(), btw.
<dsmith-work>References this: https://lists.gnu.org/archive/html/guile-devel/2011-11/msg00041.html
<pkill9>RhodiumToad, could you tell me what to put and where to fix this? This is where the error occurs: https://github.com/aconchillo/guile-json/blob/master/json/parser.scm#L282 <RhodiumToad> I guess the fix should be to read 4 hex digits, and if the value is in DC00-DFFF throw error, if it's D800-DBFF then read in an immediately following \uXXXX and error if that isn't DC00-DFFF
<minerjoe>RhodiumToad: Thanks for the help! Happy hacking!
<minerjoe>dsmith-work: you too!
<RhodiumToad>I'd change that function to something like read-hex-val removing the integer->char, and write a new read-unicode-char
<dsmith-work>minerjoe: Things are working fine for me. Was just pointing out that the guile exec calls setlocal before "booting" the library. A C application (that uses libguile) needs to do that too.
<RhodiumToad>which would read one hex val, return it via integer->string if it's <#xD800 or >#xDFFF, and process the surrogate pair otherwise
<minerjoe> dsmith-work: Yes. Thank you. Was the info I needed.
<RhodiumToad>rough draft: https://dpaste.org/muUo
<RhodiumToad>pkill9: ^^
<RhodiumToad>meh, dpaste has contracted a bad case of tabdamage
<RhodiumToad>try https://dpaste.org/1Xc9
<RhodiumToad>huh, actually maybe it's my c+p that's at fault, have to look into that