awesome! I have wanted something like this for a long time. Currently I use a janet fork <https://github.com/eshrh/matsurika> with some trivial additions, the most important of which is a `$` macro that does what the `sh` does here. I have two questions:
- I see that `sh` does not take in strings but instead lisp forms. How do you distinguish between variables that need to be substituted and commands? In my fork, the way to do variable substitution involves quasiquoting/unquoting.
- Almost all of the features that make your language good for shell scripting are essentially syntactic features that can easily be implemented as a macro library for say, scheme. Why'd you choose to write in C++? Surely performance is not an important factor here. (I'm interested because I am currently working on a scheme-based shell scripting language).
sshine 60 minutes ago [-]
Related: Schemesh — A Unix shell and Lisp REPL, fused together
Very nice! I've often wondered how close you could get to a POSIX-like syntax with something like this while maintaining a LISP semantics as much as possible. Especially pipelines are much easier to read with the | and > operators.
I guess you need some sort of LISP dialect that supports infix operators
sshine 55 minutes ago [-]
You can have regular shell infix pipes combined with Lisp/Scheme macros as control flow. I think the tradeoff that Schemesh is nice, even though it does sacrifice POSIX:
The best of both worlds of shell and Lisp is quick ability to run and pipe processes, and full programming functionality without the shell scripting shenanigans like obscure semantics and lack of good data structures.
lycopodiopsida 1 hours ago [-]
Would take threading macros over pipelines every other day of the week.
antics9 2 hours ago [-]
This looks good! I've seen other tries of shell scripting with lisp dialects but Redstart syntax looks more intuitive (from a shell scripting standpoint) and easy to read.
sakesun 1 hours ago [-]
If you don't mind .NET, BraidLang is another interesting project.
Rendered at 10:33:00 GMT+0000 (Coordinated Universal Time) with Vercel.
- I see that `sh` does not take in strings but instead lisp forms. How do you distinguish between variables that need to be substituted and commands? In my fork, the way to do variable substitution involves quasiquoting/unquoting. - Almost all of the features that make your language good for shell scripting are essentially syntactic features that can easily be implemented as a macro library for say, scheme. Why'd you choose to write in C++? Surely performance is not an important factor here. (I'm interested because I am currently working on a scheme-based shell scripting language).
https://github.com/cosmos72/schemesh
https://news.ycombinator.com/item?id=43061183 (7 months ago, 177 upvotes)
The best of both worlds of shell and Lisp is quick ability to run and pipe processes, and full programming functionality without the shell scripting shenanigans like obscure semantics and lack of good data structures.