IRC channel logs


back to list of logs

<euouae>How can I make a module that loads other modules in my repl?
<euouae>I have e.g. <> but (current-filename) resolves to #f in the REPL
<graywolf>Is there an operation to efficintly get last character of a symbol? I am currently doing (string-suffix? (symbol->string k)) but that feels suboptimal...
<attila_lendvai>so, if i were to write a catch-all error handler using a recent guile, then instead of using (catch #t ...), i should rather use (guard (c ((exception-with-kind-and-args? c) ...) ...) ...), right?
<attila_lendvai>or maybe with-exception-handler rather than guard... right?
<attila_lendvai>i keep jumping around in the manual, and i can't seem to find any guidance on this.
<dsmith>graywolf, If symbol->string doesn't copy the chars, it should be fairly efficient.
<graywolf>(eq? (symbol->string 'a) (symbol->string 'a)) --> #t should mean it does not copy, right?
<dsmith>Well, there *is* an allocation that happens
<dsmith>But it points to the symbols chars
<graywolf>Good enough for me :) And sorry for always having weird questions
<dsmith>There is an internal function, `scm_i_symbol_ref` that can index into the symbol, but it's not exposed to Scheme.
<graywolf>Oh, that is good to know. I am unlikely to make an extension for this right now, but I can see it being useful one day. But "internal" probably means there is no guarantee about it availability, so exposing it might not be a good idea I guess
<dsmith>Exactly so
<cwebber>Two games made with Hoot!!
<graywolf>Hm, how would one go about extracting documentation from the source code? Guile itself seems to use guile-snarf-docs, but that is not installed. Any tips? I am interested in solutions for both .scm and .c files...
<dsmith>graywolf, I don't have a good answwer, but I've had that question in the past too. I think in one of wingo's projects he pulled out some docs from C.
<dsmith>graywolf, It may have been guile-cairo. Maybe look there for some tips
<graywolf>Thanks :)
<dsmith>Guile is moving more and more to Scheme than C, and so the pressure (not that there was much) to extract docs from C is minimal
<graywolf>I know I will need to write some bindings to C libraries in the future, so it looked like a good idea to have that working as well. But yeah, I do plan to keep as much as possible in scheme. Guile is plenty fast for my needs.
<dthompson>binding to C libraries can be done with just scheme code
<dthompson>there is very little reason to use the guile C api these days
<graywolf>Last time I tried I run into a problem of gdb not really working well with ffi (iirc breakpoints were hit and miss to a large degree)
<dthompson>I don't do doc auto-generation, I maintain docstrings and user manuals separately, but for pulling docs out of scheme procedures you can use module introspection and procedure-documentation
<dthompson>graywolf: I don't know if using gdb on a guile program is really recommended
<dthompson>anyone got experience with it? I just use guile's debug tools
<graywolf>I needed to debug the internal of the ffi-linked library, therefore gdb, I did not really need to touch the scheme code, just wanted to have breakpoint in the c lib :)
<graywolf>but maybe there was a better way
<dthompson>ah okay
<dthompson>I don't have experience to share here
<dthompson>I used the guile c api a lot back in 2012-2013 and then moved to pure scheme with ffi
<graywolf>My current plan is to use the c api to write thin wrapper and then drive it from scheme. It is well possible I will change my mind later on :)
<dthompson>I have successfully used many C libraries this way. I've wrapped inotify, libpng, libjpeg, openal, freetype, etc. etc. etc.
<rgherdt>cwebber: awesome! Thanks for sharing
<mwette>I have run guile under gdb and been able to hit breakpoints fine loaded C .so's
<mwette>s/fine/fine in /
<mwette>wrt C api, ffi does not handle variadic args very well
<cow_2001>is there a way to sanitise *nix-y filenames (relative, directory, whatever) that come from beyond the veil?
<cow_2001>to avoid exploits