IRC channel logs

2024-07-27.log

back to list of logs

<abcdw>sneek: later tell dthompson curious why it doesn't throw exception, but just don't print anything :) BTW, How to interact with js/ts objects? Do I need to write binding generator for every property and method? Do you have any examples?
<sneek>Okay.
<dthompson>hey sneek
<sneek>Welcome back dthompson, you have 1 message!
<sneek>dthompson, abcdw says: curious why it doesn't throw exception, but just don't print anything :) BTW, How to interact with js/ts objects? Do I need to write binding generator for every property and method? Do you have any examples?
<dthompson>abcdw: it doesn't throw an exception because it's not exceptional. :) you can print a wasm value, but you won't learn anything from it.
<dthompson>abcdw: for ffi examples, check out https://gitlab.com/spritely/guile-hoot-ffi-demo
<dthompson>and this blog post https://spritely.institute/news/building-interactive-web-pages-with-guile-hoot.html
<abcdw>sneek, later tell dthompson: Yep, I think I got the basics of ffi, the question more about apps with a lot of ts/js classes, I write a plugin for https://jbrowse.org/jb2/ and it has quite a lot of things. It seems for every class I either need to write bindings for each field and method I use myself or write bindings generator.
<sneek>Got it.
<abcdw>sneek: later tell dthompson: Not exactly a question, more a sanity check :)
<sneek>Will do.
<dthompson>hey sneek
<sneek>Welcome back dthompson, you have 2 messages!
<sneek>dthompson, abcdw says: Yep, I think I got the basics of ffi, the question more about apps with a lot of ts/js classes, I write a plugin for https://jbrowse.org/jb2/ and it has quite a lot of things. It seems for every class I either need to write bindings for each field and method I use myself or write bindings generator.
<sneek>dthompson, abcdw says: Not exactly a question, more a sanity check :)
<dthompson>abcdw: yes, you'd want to write a wrapper for each method. we have an issue filed for adding a layer on top of the ffi that is specifically for making it easy to generate wrappers around js classes. (hoot ffi) is agnostic to the host platform.
<dckc_>geiser docs say "if you're on emacs >= 28..." looks like I was on 27 on this mac. upgrading to 29
<dckc_>another rosetta-stone question: what's the equivalent of: const { x, y } = foo() where foo returns a record?
<dckc_>that is: can I pattern-match on a ghash?
<dthompson>dckc_: you can't pattern match on a ghash, no. for pattern matching in general, though, use the (ice-9 match) module.
<dthompson>generally speaking, you would use record types in scheme for things that you would use objects for in javascript.
<dthompson>and records work nicely with match
<dckc_>ok, but OCapN records turn into ghashes, right?
<dckc_>dthompson ? any thoughts on pattern-matching on OCapN records?
<dckc_>er... OCapN structs?
<dckc_>hm... goblins/ocapn/marshalling.scm
<dckc_>maybe OCapN records _don't_ turn into ghashes?
<dthompson>as a user of goblins you won't see them really unless you need to marshall your own types, which I haven't personally done yet.
<dckc_>ok... syrup {} turns into ghash, and <> turns into either an unmarshalled record or a tagged. hm.
<dckc_>agoric-sdk tends to use {} things as records
<dckc_>a LOT
<dckc_>I guess another relevant idiom is multiple values. what to do... what to do...
<dckc_>weire. (assert) doesn't seem to work as expected
<dckc_>oops. now I see
<dckc_>readline keys seem to collide with mac window management keys. this is nearly intolerable
<dckc_>hm. what if I want to define an object with methods outside a vat?
<dckc_>I guess I want a record...
<dckc_>but I want field accessor names to be scoped to the record. I want to be able to do (get r 'f1)
<dckc_>maybe I can use (methods) without $?
<dthompson>you can call actors that use methods with either $ or <- if that's what you mean
<dckc_>but you have to be in a vat to do so
<dckc_>ok, so I have an ertp.scm file that defines a module. how do I use it from the repl? (use-modules (ertp)) says "no code for ertp"
<dckc_>I see a tests dir... how does it get run?
<dckc_>looks like pre-inst-env adds the source dir to GUILE_LOAD_PATH
<dckc_>(on p (do-more)) doesn't return a promise for the result of doing more???