IRC channel logs
2024-02-16.log
back to list of logs
<old>I wonder regarding the new Guile GC <old>if it is possible to have a borrow checker like Rust in a runtime that has a GC? Would it be possible to have a scheme without a GC but only a borrowing checker? <Arsen>don't see why not, with a lot of uglyfication <dthompson>I don't know how you'd map scheme's semantics onto a borrow checker <lilyp>I'm fairly certain you could do a refcounted Scheme if you forego more advanced stuff like continuations etc. <dthompson>I guess if we were to "get serious" about this we should define what "scheme" is. <dthompson>a question: could r7rs-small be faithfully implemented using a borrow checker instead of traditional gc? <dthompson>my spicy take is that borrow checking is rebranded gc for people who have decided that gc is bad <dthompson>the rust folks seem to twist themselves in knots trying to avoid gc when sometimes maybe the right answer would be to use gc <Arsen>correct, but doesn't make the above correct too ;) <dthompson>I said it was a spicy take, not nuanced, etc. etc. <Arsen>they do do that, but there's far more to putting resource lifetimes into static analysis than just memory management <Arsen>GC languages tend to be bad at that (obviously, not due to the GC, but due to overreloance on it) <lilyp>In my humble opinion, the borrow checker is C++ lifetime management for folks who don't understand C++. <dthompson>yes sure, again it was an intentionally reductionist take. kind of a joke and kind of not <dthompson>the rust rewrite of guile is going well, I hear <lilyp>r7rs-small has call/cc and that's not fun without a GC <lilyp>Well, fair, but MM-wise it's the only thing that you can not easily manage statically/with refcounts. <dthompson>well someone should feel free to write borrow checked scheme then :) <lilyp>(unless I'm gravely mistaken about lambda) <lilyp>"with focus on [...] deployability" (don't spoil the joke) <dthompson>just yesterday I was considering if I should try building deno instead of using node but then I saw the rust dependency and nope'd out <lilyp>And look at that, they too realized that call/cc doesn't fit into Rust all that well :) <dthompson>both from a "this is hard in rust" and "these are lesser used features" point of view <dthompson>not having bignums is a pretty big hole though <dthompson>I feel like I've seen at least one other scheme written in rust... <lilyp>well, those are two of the top three results from a quick search <dthompson>maybe it was a custom lisp rather than a scheme <jackhill>lilyp: as someone who doesn't yet appreciate all of C++ some of what rust is selling sounds attractive :รพ <old>borrowing checker also has the property of guaranting data race free I think <old>someting a GC can not do <old>But I guess this can all be done with good abstraction around mutex and atomic operations <old>but the Rust evangilist will say that your code can not compile if there's possible race condition <old>although I doubt that <Arsen>well, that's technically true.. but the way it achieves that is very restrictive <graywolf>Hello. If I would like to generate a guile sexp, what exactly do I need to escape/convert in a strings? I realize I need to convert " to \" and \ to \\. Anything else? <graywolf>I have a array of strings and want to generate a ("foo" "bar" ...) from it <graywolf>So I want to know how do I need to escape the the strings <graywolf>I *could* just use json, but would like to avoid introducing the dependency on json lib on the guile side <lilyp>if you have access to C you could call scm_from_utf8_string <lloda>if you use guile-raw-strings you don't need escaping <rlb>But I'd also have to double-check our docs/reader to see what we actually do right now. <apteryx>does guile do some dependency tracking itself to map .go to .scm files? <apteryx>it seems yes, as when I switch from .scm to .sld I must specify dependency relationships manually in the build system <apteryx>scheme library definition, I reckon, from R7RS <dthompson>oh interesting, I have the r7rs-small pdf open regularly and missed that <dthompson>if it's a straightforward implementation, then in case 1 a new list is cons'd up for every element in x <old>I often find myself defining a list with default thing in it and optionally more stuff if some condition is met. Thus I often do: (append (if true x '()) rest) <dthompson>the performance details don't really matter unless you have big lists, but putting the smaller list first (if order doesn't matter) will be faster <old>that or something along: (filter (negate unspecified?) `(1 2 3 ,(when #f #t))) for example <dthompson>(append '(a) '(b c d e f)) is just (cons 'a '(b c d e f)) <old>Just wondering if there's a better way to do that kind of list <dthompson>I guess I'd write it slightly different: (if add-stuff? (append '(blah) stuff) stuff) <dthompson>not really for performance but just because I like that structure more <old>you might have multiple condition <old>that add multiple different element <old>thus the when and unspecified? just scale better imo <old>in term of adding more thing <ieure>Clojure's cond-> is really nice for stuff like that: (cond-> '(b c d e f) add-stuff? (append '(foo)) add-other-stuff? (append '(bar baz))) <dthompson>yeah you could either thread it with a macro or use quasiquote or something <dthompson>multiple ways to do it, best depends on specific situation <old>oh well that was easy <ieure>old, That only works for one branch though, right? Clojure's cond-> branches fall through, so if (in my example) add-stuff? and add-other-stuff? are truthy, you get the equivalent of: (append (append '(foo) '(b c d e f)) '(bar baz)) <apteryx>re my question regarding .sld extension not being auto-compiled during the build (thus requiring manual dependency resolution in build system), it can be avoided by adding --r7rs to 'guild compile' <dthompson>without having to invent new language, you could just quasiquote it: `(,@(if foo? '(foo) '()) ,@(if bar? '(bar) '()) . ,baz) <ieure>Okay, wait, actually: (append (append '(b c d e f) '(foo)) '(bar baz)) <apteryx>this calls install-r7rs! which adds the .sld extension to the %load-extensions variable <old>ieure: hmm I think it works fine? <ieure>I am not super up on Scheme macros. <old>dthompson: right that works too <old>I don't mind having a syntax tho <rlb>...Of course you'll need to import (if . %scm-if), or similar -- see the define-module for that. <rlb>Bunch of other scm oriented clj stuff in there, fwiw. <daviid>apteryx: please wait, i'd to make a suggestion related to the interface change you propose and some other 'minor' (commit style) comment(s) - if not later today, at most till the end of this we, tx <daviid>meanwhile, would you like to point to some code where you use the added source properties arg and, if possible, paste an example of how it's effectively logged, tx <apteryx>daviid: ack, thanks for the response. will send a link to an example