IRC channel logs

2021-07-22.log

back to list of logs

*civodul pushed a Guile-Git release: https://gitlab.com/guile-git/guile-git/-/releases
<dsmith>!uptime
<sneek>I've been running for one minute and 1 second
<sneek>This system has been up 6 hours, 44 minutes
<dsmith>sneek: botsnack
<sneek>:)
<civodul>yay!
<Izem>what does the argument look like in guile for `build-uri scheme [#:userinfo=‘#f’] [#:host=‘#f’] ...` ? Is it like (build-uri #:userinfo='http ...) or (build-uri 'http ...)?
<Izem>Ah, it is like (build-uri 'http #:userinfo foo ...), the arguments with # are like labels.
<flatwhatson>Izem: they're special objects called keywords
<flatwhatson> https://www.gnu.org/software/guile/manual/html_node/Keywords.html
<Izem>thanks
<flatwhatson>any kind of "foo=bar" syntax would be quite unusual in scheme, atoms are always separated by spaces
<drakonis>leoprikler: maybe by extending a language to include some measure of a escape hatch back into guile to embed code from other langs into it?
<drakonis>its a bit silly
<flatwhatson>maybe providing a "guile ffi" library in each lang?
<drakonis>hmm
<drakonis>maybe?
<drakonis>while guile itself can access these implementations, the same might not hold true
<drakonis>but the overarching goal would be to have all manners of langs to have interop
<drakonis>kinda like uhhh
<drakonis>call out to a shell lang within guile that isnt a scheme dsl
<drakonis>a data manipulation lang
<flatwhatson>import guile
<flatwhatson>guile.eval_language("javascript", "console.log(\"hello world\")")
<drakonis>yes, like that
<flatwhatson>guile = require("guile")
<flatwhatson>guile.eval_language("python", "print(\"hello world\")")
<drakonis>it'd be like racket but done better?
<flatwhatson>the guile library would be hand-crafted for each language, so it could take advantage of any special syntax features
<flatwhatson>the next step after cross-language eval would be the ability to transfer objects/values, that's much harder
<flatwhatson>ie. not being limited to string serialization
<drakonis>i was thinking about doing this within the scope of the guile runtime and any langs implemented in it
<drakonis>ie: a lang that's built for parsing a text format like yaml and toml that will output the data in s-exps that can be converted to another lang's data structures
<mwette>drakonis: https://paste.debian.net/1205176/
<drakonis>neat
<drakonis>yes.
<flatwhatson>can we rely on strings, integers, hash-tables, records, etc. also being represented cleanly by guile's native types?
<flatwhatson>i imagine there might be some conversion needed for accurate implementation of some languages
<drakonis>dont we have quite a lot of srfis?
<flatwhatson>vector seems like the lowest-hanging-fruit of cross-language-compatible datastructures
<drakonis> https://srfi.schemers.org/ there are quite a lot of srfis for data structures thanks to r7rs-large
<mwette>i stopped working on all this to understand how objects could be implemented cross-language; I now sort-of understand how glib implements gobject; note nyacc has nx-mlang (matlab), nx-javascript, nx-tcl
<drakonis>i see.
<drakonis>it is good work
<dsmith>mwette: !! You have matlab, javascript, and tcl in/on Guile?
<drakonis>being able to do interop with those langs is important
<mwette>nothing is complete; just exploring concepts
<mwette>but javascript control structures are there ; just not objects
<drakonis>i see
<flatwhatson>javascript objects are a good example where we don't have a neat mapping to a scheme type
<flatwhatson>they're not just hashes, you need to be able to traverse the prototype tree
<flatwhatson>would they show as #<javascript-object ...> in the repl, and have their own API?
<mwette>"nx-" means both "nyacc extension" and "not exactly"; I'm willing to violate lanauge semantics to get things co-operative
<dsmith>I like it.
<dsmith>So a half way thing: Lang "X" syntax but really Scheme. Worst of both I guess. End up losing the benefits of Scheme syntax. And have something that *looks* like "X" but really behaves nothing like it.
<mwette>use case is application where you want to let users have options on language for writing extension functions
<wingo>moin
<drakonis>moin
<leoprikler>I like those ideas
<leoprikler>oh, didn't scroll all the way down
<leoprikler>I think in general something like Elisp's @ works most of the time, except when it comes to macros
<leoprikler>where you then have to arrange to (funcall (@ (guile) eval) quoted-guile-code module)
<wingo>leoprikler: if you haven't seen it, you might like https://tratt.net/laurie/blog/entries/fine_grained_language_composition.html
<leoprikler>I already like the first paragraph, given that my MT also touched on FFIs
<civodul>hey wingo!
<civodul>at first sight it sounds like the original Guile vision
<wingo>in a way yeah ;) relies quite heavily on tracing for good perf, of course
<apapsch>hello guilers! what is the correct way to reference a datadir file in a guile module? I have a config.scm.in file with (define-public %datadir @datarootdir@) though @datarootdir@ gets expanded to $prefix/share
*civodul wonders whether people really want to have one foot on one island, and the other foot on another island, to keep with their metaphor
<leoprikler>apapsch: you need to resolve @datarootdir@ on your own
<leoprikler>Guix' configure.ac has a blurb for that
<apapsch>leoprikler: thanks a lot, that clears things up
<flatwhatson>we use bash a lot as a glue language, tying together a bunch of tools in various languages
<flatwhatson>people might like to write their guix configs in python or javascript (heaven forbid)
<leoprikler>plot twist, it's python-on-guile :D
***dsmith is now known as sneek_
***sneek_ is now known as sneek__
***sneek__ is now known as dsmith
***dsmith is now known as smeek__
***smeek__ is now known as dsmith
***smartin1 is now known as smartin
***sneek_ is now known as sneek
<dsmith-work>{appropriate time} Greetings, Guilers
***bsima1 is now known as bsima
***apteryx_ is now known as apteryx
<ArneBab>flatwhatson: you mean in guile --language=ecmascript -c 'display(function () { 1 + 2; }());'
<ArneBab>What I see as most useful is tto be able to re-use libraries from different languages.
<lampilelo>is this a bug? (match 1 ((not 2 3) 'yes) (_ 'no)) => no
<lampilelo>in racket it returns yes
<lampilelo>as it should' i think
<lampilelo>s/'/,/
<lampilelo>this workaround works: (match 1 ((not (or 2 3)) 'yes) (_ 'no))
<RhodiumToad>hmm
<RhodiumToad>does seem to be a bug
<RhodiumToad>so the code and the docs disagree (so at least one of them has a bug):
<RhodiumToad>the docs say (not pat_1 ... pat_n), but the code supports only (not pat)
<cky>Racket's `match` is very different from Guile's `match` (as I well knew from implementing SRFI-41 for Guile) so I wouldn't use Racket as a exemplar of what correct Guile behaviour is. :-)
<lampilelo>both have similar doc for (not ...) though
<leoprikler>(not pat_1 ... pat_n) if all pat_1 thru pat_n don't match
<leoprikler>so RhodiumToad is right in that it's a bug
<RhodiumToad>either a code bug or a doc bug :-)
<lampilelo>i would lean towards a code bug, even though it's harder to fix ;)
<RhodiumToad>annoying that it doesn't return a syntax error rather than just silently failing
<RhodiumToad>converting it to handle multiple clauses should not be hard
<RhodiumToad>right now it's just one syntax rule for (match-two v (not p) g+s (sk ...) fk i)
<RhodiumToad>should add two more rules: one for (match-two v (not) g+s (sk ...) fk i) which should probably succeed,
<RhodiumToad>and one for (match-two v (not p ...) g+s (sk ...) fk i) which could just punt to (match-two v (not (or p ...)) g+s (sk ...) fk i) to avoid any need to duplicate the "or" logic
<RhodiumToad>actually, don't need the (not) rule
<RhodiumToad>(not p ...) will match just (not) and treat it as (not (or)) and (or) already does the right thing
<RhodiumToad>so I think just adding ((match-two v (not p ...) g+s (sk ...) fk i) (match-two v (not (or p ...)) g+s (sk ...) fk i)) after the existing clause for not should suffice
<RhodiumToad>so there you go, a 2-line fix
<lampilelo>looks fine to me
<lampilelo>so where's the upstream for match?
<RhodiumToad>"Unmodified public domain code by Alex Shinn retrieved from the Chibi-Scheme repository, commit 1206:acd808700e91."
<lampilelo>hmm... "The @scheme{not} operator succeeds if the given pattern doesn't match.", so the doc in the file does match the code
<RhodiumToad>yes
<RhodiumToad>but that's not what the guile manual says
<RhodiumToad>that comment in the file should probably be changed as well