IRC channel logs

2021-04-16.log

back to list of logs

<pkill9>maybe there's a similarity between concepts of symbols in lisp, and the concept of words being actions, or maybe i'm just overhitnking
<pkill9>overthinking*
***sneek_ is now known as sneek
*wingo has a design for faster inter-module calls, whee
<tohoyn>sneek: botsnack
<sneek>:)
<dsmith-work>Happy Friday, Guilers!!
<dsmith-work>!uptime
<sneek>up 5 days, 20 hours, 27 minutes
<rlb>wingo: vague question (and "it depends") I know, but do you have any strong inclinations wrt string processing by making an extra pass so you can do a single precise allocation of the result (or final precursor of the result) vs using a stack buffer for the common, smaller case and realloc doubling when necessary?
<rlb>(Of course sometimes it's clearer, i.e. when it might be expensive to compute the result chars (e.g. string-map, string-tabulate).)
<rlb>If not, no worries, just wanted to keep any inclinations in mind.
<manumanumanu>So... I just found myself sorting a million bytes, and finally got to write a counting sort. It ended up being about 30x faster than regular sort :)
<manumanumanu>with expected benefits being much larger when I use actual data, which might be much larger.
<p0a>Hello
<p0a>I am a newcomer to Guile, I curious if it is possible to create a secure sandbox in it, with a set of functions that the user can use.
<p0a>I think this is related to `bindings', is that what allows this?
<dsmith-work>p0a: Ya, there are ways to start with an environment that has little or no bindings, and then you can add what you want. I've never messsed with that though.
<dsmith-work>p0a https://www.gnu.org/software/guile/manual/html_node/Sandboxed-Evaluation.html
<p0a>dsmith-work: before I read about the sandboxing, I should know what bindings are
<p0a>dsmith-work: do you know where I can read on the prerequisites? I know lisp but it's been a while
<dsmith-work>Well, A "binding" is basically having a name for a value you can use it.
<p0a>so a binding is an entry in the symbol table under the scope -- or however that is expressed?
<dsmith-work>s/value you/value so you/
<p0a>are there predefined sets of bindings that are reasonable for safe evaluation? such as immutable/functional subsets of Guile
<p0a>I want the user to be able to do (+ 1 2) but I don't want to miss out on any math functions, or otherwise, that the user might need
<dsmith-work>p0a: That pages lists quite a few.
<p0a>`composite sets', got it! thanks. I looked at the page but did not understand it on a first read
<p0a>One more question: the API will include interactions with a DB. I don't want a time limit on certain bindings. Is that possible?
<p0a>(I'd prefer if the DB API timed out instead of Guile bluntly shutting down the computation)
<dsmith-work>p0a: Not sure. Never used that. But I would think you could adjust the sandbox timeout to be longer than your db timeout.
<p0a>dsmith-work: the problem would be if that info is not known to me
<p0a>or if I don't want other operations to have a long time-out, except for the db API... oh well
<p0a>That's not so important, thanks
<dsmith-work>I wonder if you could set a "none" timeout. Or maybe just a really long one.
<p0a>the server won't DDOS right?
<p0a>I'm guessing not. It really is a server for 1 user in my case. Or maybe 2-3, that's about it. I can't imagine several users using it
<wingo>rlb: no strong inclination. i guess if i had to say something it would be these priorities in descending order -- 1. avoiding buffer overflows / memory issues 2. simplicity 3. speed
<apteryx>Is it possible to forward declare a definition in a module?
<apteryx>so that it can be used before its actual definition
<lampilelo>apteryx: if it's not used before it's defined when you run the code it doesn't matter where you put the definition, you'll get warnings on compilation, but the code will work regardless
<apteryx>yeah, I'm trying to use it before it's defined
<lampilelo>in the runtime?
<apteryx>It's a huge sexp blob containing test data, I'd rather 'hide' it at the bottom of the module
<apteryx>ah, it's even used by syntax, so I guess there's no way around it
<lampilelo>you can always put it in a separate file and load it at the top of your module
<apteryx>true, although that doesn't seem to have been used in the code base so far. thanks for the ideas.
<apteryx>any pattern to load a module relative to the current module?
<apteryx>or not even a module but a source file containing the definition
***sneek_ is now known as sneek
<manumanumanu>(load "...")?
<manumanumanu>or (include ...)
<manumanumanu>include being the better choice.
<apteryx>manumanumanu: OK! And these will work no matter the CWD (e.g., they are relative to the source file it's run from?)
<manumanumanu>yes.
<manumanumanu>i believe so.
<p0a>no wait a moment
<p0a>I think it's relative to whatever the user has set up right? Before running the source file
<p0a>"If file-name is a relative path, it is searched for relative to the path that contains the file that the include form appears in. ", okay you are correct, sorry
<apteryx>thanks!
***overclucker_ is now known as overclucker