IRC channel logs
2024-05-09.log
back to list of logs
<coyote>hey everyone :-) I'm looking at Hoot and the previous year's Lisp Game Jam submission and how they used WASM-4 as a target platform, and I was wondering if that'd be possible to do while writing Scheme instead of WAT? <coyote>I thought something in `(hoot ffi)` would help but seems like that's for interacting with the JS-side of the library, right? <graywolf>Are guile modules ever garbage collected? <wakyct>or maybe I don't understand that <coyote>there is one, that's using the JavaScript reflection stuff to interact with a canvas <sneek>I've been serving for one month <sneek>This system has been up 8 weeks, 1 day, 12 hours, 49 minutes <KE0VVT>cow_2001 &al.: Should I put a newline before a docstring? <cow_2001>it's "Blah blah\nblah blah", not "\nBlah blah\nblah blah" <cow_2001>look up some other things with existing docstrings <cow_2001>let me see... what has some good docstrings? <cow_2001>i see that sqrt's docstring is generated from texinfo in ./libguile/numbers.c's line 7180 <KE0VVT>cow_2001: I see. Do put a newline before a docstring. <dokma>matijja: did you do any work on guile-websocket ?? <dthompson>coyote: wasm-4 is not a suitable host platform for scheme. you can still use the hoot toolchain to build binaries for it, though, you just won't be compiling scheme programs at that point. <dthompson>ACTION got a nice little patch in his inbox for guile-websocket <tomnor>;;; <stdin>:476:0: warning: non-literal format string <tomnor>Very confusing, that comment seem to imply there should be no warning in my example? <tomnor>In case my variable fmt is a lexical variable <tomnor>But main question is why a non-literal string is a worry <mwette>I believe non-constant format strings are considered a security risk (in C at least). One can take over the stack, IIRC. <mwette>but it's not a literal; someone can change fmt after compilation <mwette>To do things like that you can use (define (my-fmt port fmt . args) (apply format port fmt args)) I believe. <dthompson>I wish guile did safe sexp-based string formatting rather than encoding stuff in strings <mwette>dthompson: any specific reason? format strings are going to be compact (i.e., convenient) than sexps, IMO <mwette>One solution (as I use in my printf impl) is to allow format strings, or sexps (from compiling format strings). <dthompson>I'd rather have syntax that compiles to the relevant conversion + print calls and using sexps makes reading and editing much easier and expressive <dthompson>yeah format strings are compact but once you need to do anything significant it's very annoying. printing floating numbers to so many decimal places... I certainly can't remember how to do it without looking it up each time <ArneBab>old: so you could write types and compile these simply into type assertions. You could even stay close close to regular scheme feels by following how sph-sc does it: (define (myfunction a b) (int char void) "a description of this function" (return 1)) https://github.com/sph-mn/sph-sc <ArneBab>⇒ (define-typed (name arg) (return-type arg-type) <ArneBab>old: like this: (define-syntax-rule (define-typed (name args ...) (ret? types ...) body ...) (define (name args ...) (map (λ (type? argument) (unless (type? argument) (error "type error ~a ~a" type? argument))) (list types ...) (list args ...) ) (let ((res body ...)) (unless (ret? res) (error "type error: return value ~a does not match ~a" res ret?)) res))) <ArneBab>(currently only works for one-line procedures)