IRC channel logs

2021-11-03.log

back to list of logs

***robin_ is now known as robin
<apteryx>how do I manually delete an object?
<rlb>apteryx: delete in what sense?
<apteryx>as the garbage collector would
<rlb>maybe guardians, depending.
<apteryx>OK, thanks
<rlb>In general, though if you can, I'd manage resource lifetimes explicitly, i.e. files, sockets, database connections, etc.
<rlb> https://clojure.github.io/clojure/clojure.core-api.html#clojure.core/with-open
<rlb>or more generally: https://gitlab.com/clj-murphy/murphy
<apteryx>yeah, I like "context managers"
<rlb>(...included that in lokke, fwiw.)
<apteryx>I was asking out of curiosity, noticing that guile-ssh would reuse the object created by (create-session ...)
<apteryx>I've now found out that disconnect! is to be used to destroy such objects
<rlb>Yeah, since there's no telling when the gc might run (if ever, in guile, or python, or...), definitely better to mark the lifetimes explicitly.
<Sheilong>Is there something similar in Guile to the built in Python function/method 'to_bytes'?
<rlb>bytes()?
*rlb guesses you might be looking for string->bytevector or if you know it's going to be utf-{8,16,32} latin1, etc. the there are more specialized functions like string->utf-8.
<Sheilong>rlb: int.to_bytes(length, byteorder, *, signed=False)
<Sheilong>for instance: a.to_bytes(length=3, byteorder="little") b'\x00\x00\x00'
<Sheilong>where a = 0.
<rlb>Depending on what you're after, maybe this is in the right area: https://www.gnu.org/software/guile/manual/html_node/Bytevectors-as-Integers.html
***nckx is now known as Thunderbi
***Thunderbi is now known as guix-znc-test
***guix-znc-test is now known as guix
***guix is now known as nckx
<dsmith>Ok, that bobot++ build problem is a g++ thing I think. Same commandline works fine (libs before objects) with g++ 6.3.0. Doesn't resolve symbols with g++ 10.21
<dsmith>10.2.1
***talas_ is now known as talas
<qwitwa>why should I use guile
<drakonis>idk, should you?
<qwitwa>¯\_(ツ)_/¯
<drakonis>its a scheme i guess?
<qwitwa>what sets it apart from other implementations?
<qwitwa>use-case here is embedding into a c++ game
<RhodiumToad>embedding into apps was one of guile's design goals.
<drakonis>okay cool.
<drakonis>its the way you're phrasing your question makes it really difficult to take it seriously
<RhodiumToad>it's not as easy to embed as, say, lua
<RhodiumToad>but easier than some other languages, I think
<morganw>If it was a C++ game for Windows would there be a problem? (I'm also dabbling with using it for a game)
<drakonis>probably not?
<RhodiumToad>I don't personally have windows experience, but I don't see any reason why it would be a problem
<drakonis>i'm not sure about the windows story
<drakonis>it should work i guess?
<qwitwa>What's the deal with r7rs?
<qwitwa>The compatibility information I can find says guile doesn't conform  totally for historical reasons
<qwitwa>which is fine, but
<qwitwa>it doesn't tell me what I'd be better off using
<drakonis>r7rs had a bit of a rough story with every scheme
<drakonis>not just guile
<drakonis>it is divided in r7rs-small and r7rs-large, the latter is better accepted so far
<ArneBab>I’m clearly in favor of r7rs: It actually managed to re-unify many different Scheme-Implementations: https://ecraven.github.io/r7rs-benchmarks/
<ArneBab>It’s not perfect, but with the split between r7rs-small and r7rs-large, the r5rs and the r6rs Schemes are actually becoming compatible again.
<ecraven>drakonis: it mainly had a rough story with the kind-of-r6rs schemes, many implementors of smaller implementations followed r7rs-small right away
<ecraven>but from an r6rs-perspective, it's a step backwards (or at least sideways), I understand that ;)
<drakonis>r7rs is a huge step forward
<drakonis>large, that is
<ecraven>keep in mind that not all of the Schemes in that benchmark actually support R7RS, most of them need some sort of shim to work
<ArneBab>r7rs-large might re-add syntax-case — the poll for that is open right now.
<drakonis>as it makes standards compliant scheme competitive
<drakonis>far more competitive
<ArneBab>drakonis: yes
<drakonis>it also allows other schemes to have a stronger batteries included story like racket does
<ArneBab>and it collects and unifies SRFIs which can make it much easier to get started with practical work.
<ArneBab>The SRFIs by themselves are pretty hard to use, because you first have to learn for yourself which ones are the canonical way forward
<drakonis>it is certainly an improvement
<drakonis>by the way, when is guile getting better build tools?
<drakonis>i recall that hall can be a bit fiddly to set up
<ArneBab>I’m nowadays using conf (self-written tool to quickly set up an autotooled project: https://hg.sr.ht/~arnebab/conf )
<ArneBab>conf new -l guile foo
<drakonis>neat.
<ArneBab>The first thing I created with it, though, are autotooled bash scripts, because that solves the problem of packaging data with bash scripts.
<ArneBab>(it’s what conf uses itself, so the templates get installed where they are found)
<ArneBab>(and I tootally did not blog about it yet, so just about no one learns about that who isn’t by chance on IRC)
<ArneBab>(sadly the above is not irony)
<drakonis>hahaha
<jab>is there a way to loop through each fieldname of a record? Suppose you don't want to hard-code each record name by hand, but instead wanted to loop through each fieldname of a record that anyone wrote.
<RhodiumToad>any particular sort of record?
<jab>RhodiumToad: yes.
<jab>I'm thinking in the context of (guix records).
<jab>specifically for my opensmtpd service
<jab> https://notabug.org/jbranso/linode-guix-system-configuration/src/master/opensmtpd.org#todo-it-might-be-a-good-idea-to-completely-rethink-how-i-am-making-this-service
<jab>various fieldnames need a <opensmtpd-table>. It would be nice to take a look at the <opensmtpd-configuration> and get a list of all of the <opensmtpd-table> records.
<jab>I can create a function that hardcodes and checks various places for tables, but it would be nice to programmatically do that instead.
<RhodiumToad>I don't do guix myself, so I don't know what its records are; but what you wanted is doable in, I believe, all the record implementations in the guile distribution
<jab>RhodiumToad: can you send me a pastebin, or point in the direction of the procedure that I may want to use?
<ArneBab>jab: do you mean something like enum.values() in Java?
<RhodiumToad>jab: for native records and srfi-9 records, something like
<RhodiumToad>(map (lambda (f) ((record-accessor (record-type-descriptor fred) f) fred)) (record-type-fields (record-type-descriptor fred))) will give the values of a record
<jab>ArneBab: that should work.
<jab>RhodiumToad: thanks!
<RhodiumToad>for rnrs records, there are similar functions
<RhodiumToad>might even be the same functions, I didn't check the definitions
<ArneBab>Would be nice to have a function that works for them all …
<RhodiumToad>of course if you have structs or goops classes then you have a different problem
<RhodiumToad>or smobs
<RhodiumToad>it looks like the equivalent functions for rnrs records require you to check the parent record type yourself, i.e. you get only the fields of the most-derived type, and then have to recurse to the parent
<jab>RhodiumToad: thanks
<drakonis>ArneBab: how's guile doing with regards to r7rs-large support?
<drakonis>RhodiumToad: but would you use if it supported your OS of choice?
<RhodiumToad>probably not
<drakonis>hmm, aight
<qwitwa>Any idea why (eval-options 'full) seems to cause a crash on my machine?
<qwitwa>the other optionsets work okay
<ArneBab>drakonis: I don’t know the state of r7rs-large on Guile — I’m currently discussing in on r7rs-large itself, it in Guile is a second step.
<ArneBab>drakonis: I use Guix and don’t want to switch away, though it has quite some rough edges if you earn your living with proprietary software development.
<ArneBab>qwitwa: we had a discussion about r7rs the past hours
<qwitwa>Cool, just checked the log
<drakonis>same here
<drakonis>trying to figure out how to make a daemon
<drakonis>it is a simple as using a while and the appropriate signal checks, right?
<qwitwa>that sounds like it'd block the main thread
<drakonis>probably not?
<qwitwa>Whats the package management story for guile like?
<qwitwa>Use Akku?