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?
<lechner>nij- / maybe that referred to Guile's amazing interface, for its time, which enabled configuration files to be written in Scheme. It was the start of reframing the world in Guile, as Guix does today https://www.gnu.org/software/guile/docs/guile-tut/tutorial.html
<nij->lechner How does this relate to that guile embeds SCM?
<drakonis>nij-: its faster and easier to embed
<drakonis>do remember that hardware at the time was orders of magnitude slower than today
<drakonis>the first release dates to '93
<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>we sure do
<drakonis>performance and some measure of runtime flexibility
<nij->it perfors better if embedded?
<drakonis>that's not it, no.
<drakonis>the point is that you embed a far more flexible language inside a fast one
<drakonis>see also factorio
<drakonis>it embeds lua for mods
<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
<nij->hmm
<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
<flatwhatson>no harder than using any other C library
<nij->I mean, to embed a whole language into C.. that is very hard, no?
<singpolyma>nij-: most languages start that way :)
<nij->start which way ?
<flatwhatson>it's common to write programming language implementations in C
<nij->hmmm..
<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.
<nij->IIRC..
<flatwhatson>looks like this is the SCM you're referring to: https://people.csail.mit.edu/jaffer/SCM.html
<flatwhatson>that bit of history is documented here: https://www.gnu.org/software/guile/manual/html_node/Early-Days.html
<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>"embedded in C" doesn't really make sense
<flatwhatson>embedding generally means using as a library
<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>dsmith: Greetings!!
<dsmith>sneek: botsnack
<sneek>:)
<dsmith>!uptime
<sneek>I've been running for 5 days
<sneek>This system has been up 2 weeks, 5 days, 11 hours, 56 minutes
<dalepsmith>sneek: botsnack
<sneek>:)
<dsmith-work>Hey Hi Howdy, Guilers
<dsmith-work>Where did go, sneek?
<dsmith-work>(Spectrum is currently having an outage)
<dsmith-work>sneek: botsnack
<sneek>:)
<dsmith-work>!uptime
<sneek>I've been running for 5 days
<sneek>This system has been up 2 weeks, 5 days, 18 hours, 1 minute
<dsmith-work>Goodbot!
<old>sneek: botsnack
<sneek>:)
<sneek>metaphone for dsmith-work is tsm0wr
<sneek>metaphone for dsmith is tsm0
<dsmith-work>Emacs rocks episode on paredit: https://emacsrocks.com/e14.html