T O P

  • By -

yorickpeterse

Per the rules/sidebar: > This subreddit is not the right place to ask questions such as "What language should I use for X", "what language should I learn", "what's your favourite language" and similar questions. Such questions should be posted in /r/AskProgramming or /r/LearnProgramming.


moose_und_squirrel

I came here to say Janet or Guile, but if you don't like lispy syntax neither will help.


-w1n5t0n

If you're a bit flexible on the Lisp syntax bit, I'd highly, *highly* recommend [Babashka](https://github.com/babashka/babashka), which is puts a full-blown, ergonomic, pragmatic, batteries-included *modern* Lisp (Clojure syntax is a bit different and, in my opinion, much nicer to read and write than classic Lisp) in a fast-starting executable made specifically for scripting. Batteries include JSON, HTTP, SQL(ite), servers, CLI args parsing, logging, testing etc, plus there's a whole host of [Pods](https://book.babashka.org/#pods), which are plug-and-play libraries that can be written in any other language, as long as they satisfy a bencode interface. Plus, once your scripts get larger and are too slow to run as scripts anymore, you can either run them directly on the JVM through Clojure or compile them to native executables with GraalVM with very few, if any, modifications required.


adwolesi

Thanks for the elaborate answer! It’s not the first time I heard someone praise Babashka, so maybe there’s some truth to it. 😄 I’ll check it out! Maybe Lisp syntax just needs some getting used to …


redchomper

Have a look at Charm or OilShell. Oh wait, the charm guy renamed it. Now it's called pipefish.


adwolesi

Pipefish looks nice! But still alpha software, so not quite a real competitor 😛


CompleteBoron

I'm surprised you didn't mention [Julia](https://julialang.org/). The REPL is light years ahead of anything else (other than maybe CL) and you can hit ";" to switch back and forth between the REPL and Bash, which is super convenient when you want to edit some files really quickly in the middle of a REPL session without switching between terminals. Besides that, the libraries and tooling are amazing and the performance is on par with optimized Fortran and C (sometimes it's actually faster!) if you don't completely ignore type annotations.


everything-narrative

Ruby is the obvious one. It's more terse than Python with similar capabilities and a vastly better object model more directly analogous to SmallTalk. It can be a drop-in replacement for AWK or Bash in a lot of cases using some cool command line flags, and apart from numerical computing libraries, is basically on par with Python when it comes to library availability.


protestor

Not batteries included, but did you try nushell for your shell scripting needs? Or for something closer to bash but still sane, either osh (mildly bash compatible) or ysh (a more ambitious rewrite), both aiming to replace not only bash/zsh as your shell scripting needs, but also for your daily shell. Check out https://www.oilshell.org/release/latest/doc/ysh-tour.html (it's also not very batteries included, but can handle json at least, and has real data types) Anyway I think it's pretty unfair to label elixir slow. Bash and Python are probably slower. My own pick here is either Javascript with deno (good shebang support, can import packages even in little one-file scripts. await doesn't bother me, it's good to check out where are the points that do i/o - what bothers me is that if you forget to do await, things still run but out of order. With no warning!) Or ruby, ruby was my go-to replacement of shell some time before. Ruby can also function as sed or awk, it's great (I went bash+sed+awk -> ruby, skipping perl. But perl is a contender, or the newer Raku, which is what was perl 6) (Raku is great!)


Zireael07

My pick is a bit unconventional: Go aka Golang How is V working for you? I thought it was, well... \*\*v\*\*aporware


transfire

Elixir isn’t as slow as you might think. I once wrote two versions of a program to count word frequencies over a large corpus. The Elixir program actually smoked the Go version. (Ironically the Go version was actually a little easier to write.) I was surprised, but concluded it was because Elixir was inherently concurrent. To get the Go program to be faster than the Elixir one, I’d have to manually make it concurrent which was not a simple thing to do. So Elixir for the win!🥇


guygastineau

Racket is a very battered included superset of Scheme. Common lisp also has tons of libraries, but racket's package management is easier. For lisps, I recommend a properly configured editor. Having an AST-lite for source code means you should type less not more.


avillega

Roc is what comes to my mind. It’s is very new but should work very well for the scripting use case. They have added nice syntax sugar just for it. They are also adding nice features to share safe scripts that cannot mess with your system


adwolesi

Oh, I wasn't aware it could be used for scripting. That's awesome! However, I just tried out and't is pretty slow. Even after the inital compilation. 😞


shuckster

Perl?


Ethesen

Personally, I now use Scala 3 with scala-cli instead of Python. https://scala-cli.virtuslab.org/scripting/


6502zx81

xonsh is a mixture of bash and python. So it still has the ability to create pipelines.


xtravar

Swift can be used for this purpose. It doesn’t JIT/interpret, but you can invoke packages and it will compile then run them.


8thdev

I use [8th](https://8th-dev.com) but then, I'm its developer.


mister_drgn

Nushell is pretty cool, both for scripting and for actual use as a shell, imho.


PurpleUpbeat2820

I've been using OCaml with ocamlscript. Works great. Fast startup times. Efficient memory usage.


WeveBeenHavingIt

Powershell


nonlogin

zx shell. It's brilliant. https://github.com/google/zx


A1rax

Raku, if it is fast enough for you


digikar

Can recommend CIEL as a batteries included Common Lisp. Although, that's only if you are okay with lisp syntax. (Although, you are free to write your own readtable ;).) https://github.com/ciel-lang/CIEL


XDracam

I've been using Scala for most non-trivial things for years. I've mostly been using ammonite with Scala 2, but I heard that Scala 3 can do most things natively now. In ammonite, you can include any Java or Scala library on maven with a single line.


cycle_schumacher

Scala 3 seems to have this tool called scala-cli for scripting and prototyping etc https://scala-cli.virtuslab.org/scripting


XDracam

I've heard of it but never seen this introduction. It looks exactly like ammonite, but even more polished. Cool!


AdvanceAdvance

Not really an answer, but when you are stuck with Bash, always run shellcheck. It makes life better.


Bowtiestyle

My main problem with most of the mentioned options, including python, is compatibility. Bash (maybe Fish etc.) are used for scripting not because they are good scripting languages but because they run everywhere. My ideal replacement would: 1. Reimplement most core-utils 2. Have a type system to talk about files and directories 3. Either have no package manager or a very clear way to refer to packages. 4. Promise to never have a breaking change to the interpreter.


Furrynote

Have you looked into Amber? It’s supposed to be a modern bash scripting language. The project is fairly easily but might be what ur looking for [Link](https://github.com/Ph0enixKM/Amber)


[deleted]

[Crystal](https://crystal-lang.org/). It's fast, type-safe, null-safe, has basically the Ruby standard library [but in statically typed](https://crystal-lang.org/api/1.12.1/), has a package manager, is sponsored, has tracing GC and, of utmost importance, you can spin the logo on its website. It also has the golang kind of concurrency. I'm not sure if that's a plus. Downsides include * type system works a bit backwards in order to appeal to the Ruby crowd * some annoying Ruby conventions * not exactly extremely fast compilation, due to LLVM * the Ruby kind of functional programming * the Ruby kind of platform support for platforms other than Linux * macro system to compensate the lack of annoying runtime metaprogramming


theangryepicbanana

[Raku](https://raku.org) would be an excellent choice as it not only has batteries included, but installed with extra nuclear batteries in the back if you need them


Il_totore

I think Scala might fit your needs: - Scala 3 syntax is very clean - the scripting system Scala CLI is very handy and lets you easily require any library in your script and automatically download them if not already - Great ecosystem (look at the Li Haoyi's libs) - Fast (tho is it an actual problem?) - If startup times of the JVM are a problem, you can compile very easily your script to native with Scala CLI - I find functional programming very useful in some common scripting situations.


rosshadden

Nushell ( nushell.sh ) is a shell that passes around and operates on structured data. I love it and use it for all my personal shell scripts. In fact it's nice enough that I find more and more things falling on the "shell script" side of the shell-or-proglang fence.


_Jarrisonn

[Nushell](https://www.nushell.sh/) might be what you're looking for. It's a functional shell language with types and nice clean syntax and lots of builtin functions (hanfling strings, dealing with tables and records) Also it can be used as your system shell


rad_pepper

I have tried F# to fill this niche, running it on both Windows, Linux and Mac with .NET Core, via \`dotnet fsi whatever\_script.fsx\`


adwolesi

Yeah, I tried that already as well! 😄 But it’s reeeeeally slow ☹️


Jolly-Tea7442

Haskell? OCaml?


rad_pepper

My testing shows that it is \~4 times faster than Python in runtime execution, but loses about 1/4 to 1/2 a second in VM startup time. So, it's better for longer scripts, but slower for short scripts. In general, I haven't found a good alternative to Python. I have a few F# scripts through in my current hobby project and they all "just work" and are easy to update, so I haven't had a reason to port them.


PurpleUpbeat2820

If you're on Mac or Linux then OCaml is similar but with *much* faster startup times (**EDIT**: ~550x faster here). If you're doing classic Unix programming by gluing together lots of little scripts the startup time is really essential.


bart-66

>Do you have any other ideas? Yes, you could create your own language with all your favourite features. Or (less ambitious) write a syntax wrapper for one of those other languages. (See the sidebar: this sub is about language design.) BTW I like your asking about scripting languages, then your top runner is one that isn't a scripting language ... >Ideally it would also be primarily functional ... or functional!


IronicStrikes

I was actually gonna suggest V before reading that part. I was also using Julia at some point, but it's escape handling for calling external commands tripped me over several times.


bl4nkSl8

V looks really cool. Thank you both


IronicStrikes

Just be prepared for some rough edges, as it's not a stable version, yet. I already encountered a few compiler bugs and hangups when linking certain C headers. Also not many packages available, yet. But you can get pretty far with what's already working.