IRC channel logs
2022-11-14.log
back to list of logs
<nij->I read that guile was first derived from SCM, making SCM "embeddable". Why was it a need to "embed" SCM? What are some advantages of that comparing to, say, having a separate process which is communicatible? <nij->lechner How does this relate to that guile embeds SCM? <drakonis>do remember that hardware at the time was orders of magnitude slower than today <nij->Oh, I see. Back then that was indeed the case.. <nij->How about todays? Do we still care if we can embed a language to C? <drakonis>performance and some measure of runtime flexibility <nij->it perfors better if embedded? <drakonis>the point is that you embed a far more flexible language inside a fast one <nij->if an embedding of a flexible lang into a fast one doesn't make the flexible lang faster <nij->what is beneficial then? <flatwhatson>you do the perf-sensitive bits in the fast language, and call them from the slow language <nij->But that's achievalbe too by calling separate processes, right? <flatwhatson>see eg. python + numpy, where python is slow and numpy provides fast math functions written in C <flatwhatson>using separate processes means you need to do inter-process communication (IPC) <nij->oh, and with embedding, communication is easier and faster? <flatwhatson>so now you're doing stuff like serializing your data over sockets, or using shared memory segments <flatwhatson>with embedded Guile, it's easy to write a C function which returns a Scheme value directly <nij->with shared memory it's as fast <flatwhatson>you still need an agreed format for the data with shared memory <flatwhatson>so either using serialization, or the C API headers that you'd already be using for embedding <flatwhatson>also shared memory is just painful & messy & surprisingly complicated <nij->oh! so even comparing with shm, it'd faster to use embedding! <nij->hmm haven't really put my hands on shared memory.. but I guess to embed a language is also very hard <flatwhatson>yes. shared memory requires some kind of synchronization for a start <flatwhatson>embedding isn't hard, if you have a C project you just include "libguile.h" and read some docs on how to use it <nij->I mean, to embed a whole language into C.. that is very hard, no? <flatwhatson>it's common to write programming language implementations in C <flatwhatson>do you mean, in general? or a specific language like Guile? <flatwhatson>because Guile is easy to embed in C, everything you need is provided & documented <flatwhatson>the core of Guile is written in C, so integrating with C is straightforward <nij->Back then, before Guile, SCM wasn't embedded in C. <flatwhatson>> GEL was the product of converting SCM [...] into something more appropriate to embedding as a library. <flatwhatson>so it looks like SCM is already written in C, and they refactored it a bit to make it easier to embed in other C programs as a library <nij->Oh.. hmm.. so there's another thing called "embedded as a library"?! <nij->How does that differ from being embbeded in C? <flatwhatson>like SCM is written in C, but I guess difficult to use as-is in another C program (ie. embed in another C program) <flatwhatson>Guile is organised in a way that it provides libguile, which is easily used from other C programs <flatwhatson>they didn't "embed Guile in C", they made it EASY to embed Guile in other C projects <sneek>I've been running for 5 days <sneek>This system has been up 2 weeks, 5 days, 11 hours, 56 minutes <sneek>I've been running for 5 days <sneek>This system has been up 2 weeks, 5 days, 18 hours, 1 minute <sneek>metaphone for dsmith-work is tsm0wr <sneek>metaphone for dsmith is tsm0