4 ms·
What I would love to have is a Lisp which is as easy to embed (and as portable) as Lua but comes with all the niceties of Lisp like a restart-system, REPL-drive
by HexDecOctBin 2y ago
What I would love to have is a Lisp which is as easy to embed (and as portable) as Lua but comes with all the niceties of Lisp like a restart-system, REPL-driven development, numeric tower, hygienic and non-hygienic macros, etc.
Unfortunately, no such thing seems to exist.
- Zambyte 2y agoMaybe GNU Guile?
- whartung 2y agoYou’d think Guile would work. That sounds like a Guile checklist to be honest. But that said, my random forays into Guile have been met with frustration. I can’t say anything specific, but for whatever reason, whenever I tried to use it, I’d get no momentum on my little project du jour, and I’d shelve it once again, moving on to something else. Perhaps next time it’ll click.
- zelphirkalt 2y agoIf I may briefly advertise my Guile examples repository: https://codeberg.org/ZelphirKaltstahl/guile-examples https://codeberg.org/ZelphirKaltstahl/guile-examples Perhaps it will be useful.
- HexDecOctBin 2y agoI am a bit biased against GNU libraries. Maybe irrationally so, but I haven't had a good experience with them all the way down from Glibc. They have a tendency to be developer-hostile in very high-handed ways (sort of how GNOME treats its users). I wonder how many people still remember this piece of code: __asm__(".symver memcpy,memcpy@GLIBC_2.2.5"); Plus, the LGPL license will ensure that it can't be shipped on a multitude of platforms (iOS I believe, game consoles, etc.)
- hatefulmoron 2y ago> Plus, the LGPL license will ensure that it can't be shipped on a multitude of platforms (iOS I believe, game consoles, etc.) Just for my understanding, is this based on the fact that these platforms don't allow the user to modify or upgrade Guile to another version in the future?
- HexDecOctBin 2y agoI believe that iOS simply didn't allow any LGPL code on App Store, though I don't remember the exact reasoning.
- hatefulmoron 2y ago(This is just from my very quick searching, so please correct me if I'm wrong.) I don't think there's any restrictions on LGPL code for the App Store, but the restrictions I mentioned earlier are probably tricky to conform to[1]. [1]: https://stackoverflow.com/questions/35068054/does-app-store-accept-qt-app-linked-with-qt-library-lgplv3 https://stackoverflow.com/questions/35068054/does-app-store-...
- HexDecOctBin 2y agoYeah, seems like even VLC is there. I remember that there used to be some issue with FSF licenses on the App Store, but it's been almost a decade, so I can't recall the details. I do remember switching out OpenAL-soft due to this issue.
- solidsnack9000 2y ago""" Hundreds of software projects today contain the mysterious line __asm__(".symver memcpy,memcpy@GLIBC_2.2.5"); as a lasting memory of this glibc debacle. I just added it to my code as well. """ https://www.win.tue.nl/~aeb/linux/misc/gcc-semibug.html https://www.win.tue.nl/~aeb/linux/misc/gcc-semibug.html
- rcarmo 2y agoJITed Guile is interesting, but Guile itself seems to live in a weird superposition state—it’s been around forever but there aren’t a lot of projects actually using it, so you’re stuck trying to figure out the best ways to, say, serve HTTP or set headers on requests.
- AHTERIX5000 2y agoLast time I checked Guile it was somewhat hard to get working on Windows, build tooling was a classic autotools mess compared to Lua consisting of a few ANSI compatible C files. Also Guile (and many other embeddable scripting languages) want to initialize global state which I'd prefer not to.
- c-cube 2y agoI don't think it has absolutely all that, but janet might be close? https://janet-lang.org/ https://janet-lang.org/ https://janet.guide/ https://janet.guide/
- HexDecOctBin 2y agoJanet has a way to break into REPL, but AFAIK no way to restart (a la condition system). Fennel has something a bit more robust (assert-repl) and it can restart, but can only return a single value from the REPL, which often creates more errors downstream.
- giraffe_lady 2y agoIt's been a couple years but I think janet has the primitives for this in the netrepl module which I think is part of the standard library. I remember being really surprised at how much introspection and control over the env when you responded to a repl connection, just at that time no one had put it together into what you want. I also seem to remember the actual janet repl being a different implementation which always seemed weird to me.
- HexDecOctBin 2y agoAny reference for this? The docs[1] don't seem to have much of anything. [1]: https://janet-lang.org/api/spork/netrepl.html https://janet-lang.org/api/spork/netrepl.html
- giraffe_lady 2y agoYeah that standard lib extension has always been extremely underdocumented. I thought I remembered being able to manipulate the env as a dynamic which I think could get you what you need. But reading the source now I guess not? I'm pretty out of practice reading janet.
- rcarmo 2y agoJanet is nice, but the ecosystem is too small. I’ve actually uninstalled it from my Macs recently because I ended up not using it, whereas I can take any C and Lua library and do something with Fennel. The only real issue with Fennel is luarocks—the experience of adding new libraries (or general dependency management) to a (Lua) project is still gnarly.
- ristos 2y agoChibi scheme has almost all of those things, except non-hygienic macros: https://synthcode.com/scheme/chibi/ https://synthcode.com/scheme/chibi/ It's R7RS scheme, which is a very small, well designed core for lisp. 13k LOCs of C. Very easy to embed, and a nice C FFI. I absolutely love it. Geiser supports Chibi scheme out of the box, and I wrote this simple nREPL for it that I use: https://github.com/Risto-Stevcev/chibi-repl-server/ https://github.com/Risto-Stevcev/chibi-repl-server/ I use delimited continuations for conditions and restarts: https://gist.github.com/Risto-Stevcev/e6fd8417e34ef74a74adfadc468ea7d1 https://gist.github.com/Risto-Stevcev/e6fd8417e34ef74a74adfa...
- HexDecOctBin 2y agoChibi seems to rely on Cygwin/MSYS for Windows which is a pretty heavy dependency (and very non-Lua). https://github.com/ashinn/chibi-scheme/blob/master/README-win32.md https://github.com/ashinn/chibi-scheme/blob/master/README-wi...
- ristos 2y agoI think the posix stuff is only if you're using some of chibi's batteries-included libraries, like filesystem, regexp, shell, tar, zlib. You can probably pretty easily just stub all those files or remove them from the make build and it should build fine. The r7rs core code and libraries don't rely on anything posix related.
- HexDecOctBin 2y agoI see, thanks! Will take a look at it.
- rscho 2y agoS7 (https://ccrma.stanford.edu/software/snd/snd/s7.html https://ccrma.stanford.edu/software/snd/snd/s7.html) is made to be embedded. It's very spartan, but has some of those features.
- HexDecOctBin 2y agoI tried figuring out how to do REPL-driven programming (condition system, restarts, etc.) But couldn't figure out how to. Any references?
- eadmund 2y agoThere’s Embeddable Common Lisp: https://ecl.common-lisp.dev/ https://ecl.common-lisp.dev/ Most recent release was May of this year. I don’t know if it is as portable as Lua, but it should basically run anywhere you can call into C. You’d have to import a third-party hygienic CL macro system, though. But in return you get a full-fledged Lisp.
- HexDecOctBin 2y agoI believe ECL uses global state, which makes the interpreter non-reentrant, which in turn makes running multiple scripts extremely difficult (one would need to add a GIL).