News for hackers. Stuff that matters.
Re:The Fennel Programming Language by HexDecOctBin on Sunday September 08, 2024 @07:30PM (#41484154)
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.

Re:The Fennel Programming Language by c-cube on Sunday September 08, 2024 @08:11PM (#41484360)
I don't think it has absolutely all that, but janet might be close?

https://janet-lang.org/ https://janet.guide/

Re:The Fennel Programming Language by HexDecOctBin on Sunday September 08, 2024 @08:21PM (#41484411)
Janet 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.

Re:The Fennel Programming Language by giraffe_lady on Sunday September 08, 2024 @08:50PM (#41484550)
It'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.
Re:The Fennel Programming Language by HexDecOctBin on Sunday September 08, 2024 @09:16PM (#41484685)
Any reference for this? The docs[1] don't seem to have much of anything.

[1]: https://janet-lang.org/api/spork/netrepl.html

Re:The Fennel Programming Language by giraffe_lady on Sunday September 08, 2024 @10:26PM (#41484965)
Yeah 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.

Re:The Fennel Programming Language by rcarmo on Monday September 09, 2024 @02:57AM (#41486078)
Janet 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.

Re:The Fennel Programming Language by ulbu on Monday September 09, 2024 @03:23AM (#41486192)
it has the opposite of the numeric tower – numbers are floats. (ugh)
Re:The Fennel Programming Language by Zambyte on Sunday September 08, 2024 @07:43PM (#41484238)
Maybe GNU Guile?
Re:The Fennel Programming Language by HexDecOctBin on Sunday September 08, 2024 @07:57PM (#41484304)
I 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.)
Re:The Fennel Programming Language by hatefulmoron on Sunday September 08, 2024 @08:57PM (#41484582)
> 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?

Re:The Fennel Programming Language by HexDecOctBin on Sunday September 08, 2024 @09:12PM (#41484670)
I believe that iOS simply didn't allow any LGPL code on App Store, though I don't remember the exact reasoning.
Re:The Fennel Programming Language by hatefulmoron on Sunday September 08, 2024 @09:42PM (#41484803)
(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-...

Re:The Fennel Programming Language by HexDecOctBin on Sunday September 08, 2024 @09:50PM (#41484828)
Yeah, 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.
Re:The Fennel Programming Language by solidsnack9000 on Sunday September 08, 2024 @11:39PM (#41485239)
"""

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

Re:The Fennel Programming Language by whartung on Sunday September 08, 2024 @07:50PM (#41484274)
You’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.

Re:The Fennel Programming Language by zelphirkalt on Monday September 09, 2024 @08:07AM (#41487767)
If I may briefly advertise my Guile examples repository: https://codeberg.org/ZelphirKaltstahl/guile-examples Perhaps it will be useful.
Re:The Fennel Programming Language by rcarmo on Monday September 09, 2024 @02:58AM (#41486090)
JITed 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.
Re:The Fennel Programming Language by AHTERIX5000 on Monday September 09, 2024 @07:34AM (#41487518)
Last 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.

Re:The Fennel Programming Language by ristos on Monday September 09, 2024 @03:07AM (#41486121)
Chibi scheme has almost all of those things, except non-hygienic macros: 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/

I use delimited continuations for conditions and restarts: https://gist.github.com/Risto-Stevcev/e6fd8417e34ef74a74adfa...

Re:The Fennel Programming Language by HexDecOctBin on Monday September 09, 2024 @07:33AM (#41487515)
Chibi 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-wi...
Re:The Fennel Programming Language by ristos on Monday September 09, 2024 @10:58AM (#41489128)
I 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.
Re:The Fennel Programming Language by HexDecOctBin on Monday September 09, 2024 @03:07PM (#41492321)
I see, thanks! Will take a look at it.
Re:The Fennel Programming Language by rscho on Monday September 09, 2024 @06:52AM (#41487199)
S7 (https://ccrma.stanford.edu/software/snd/snd/s7.html) is made to be embedded. It's very spartan, but has some of those features.
Re:The Fennel Programming Language by HexDecOctBin on Monday September 09, 2024 @07:32AM (#41487504)
I tried figuring out how to do REPL-driven programming (condition system, restarts, etc.) But couldn't figure out how to. Any references?
Re:The Fennel Programming Language by eadmund on Monday September 09, 2024 @11:45AM (#41489685)
There’s Embeddable Common Lisp: 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.

Re:The Fennel Programming Language by HexDecOctBin on Monday September 09, 2024 @03:13PM (#41492395)
I 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).