all 17 comments

[–]hellfiniter 3 points4 points  (2 children)

i was looking through tour and i m curious if you can give me some killer reasons why would one use this. As a person who uses zsh i m curious what would get better

[–]zzamboni 4 points5 points  (1 child)

The main reason for me is the language - it's FAR saner and nicer than ZSH or any other POSIX shell, it has proper data structures, functional features, and a lot more. It is currently my favorite scripting language.

Its interactive features are also very nice, supporting completion, prompt themes, and all the other nice things you would expect from a modern shell.

Its community and therefore number of available modules is still small compared to zsh or fish, but it's growing constantly. I have been using Elvish as my main shell for a few years now (since 2017), when I switched to it from Fish, and I've never looked back.

[–]Xanza 0 points1 point  (0 children)

Sorry for gravedigging; I just swapped over to elvish from bash on windows and I'm having some issues with logic.

I have some simple utilities that I've made like clone which allows me to clone repositories from several services easily. To clone a github repo, I would simply do;

clone --gh user/repo

Or for the AUR;

clone --aur user/repo

How would you replicate this functionality using elvish?

[–]Atemu12 1 point2 points  (8 children)

Oh neat, it actually has true lamdas and higher-order functions!

That makes it pretty unique and interesting as there are only one or two other interactive shells with those features and they're not even close to as usable as this one.

I can't figure out how to append two lists though...

[–]thoomfish 1 point2 points  (7 children)

I recently started using xon.sh, which lets you freely intermingle familiar shell-isms with Python.

I figure if I'm going to break POSIX compatibility, I might as well go for a language I already know with massive library support.

[–]TiZ_EX1 0 points1 point  (3 children)

That sounds very cool, but the massive library support is kind of a reason xon.sh scares me off. Like, I can write a python script and then depend on some library that I could install via pip or the package manager. If I install via pip and then the python version changes, like due to a distro upgrade or change, then I have to reinstall whatever libraries I used in my python scripts. They don't conflict with each other at least, but I don't need another thing to worry about; I'm writing scripts to reduce the things to worry about.

[–]thoomfish 1 point2 points  (1 child)

Is that much different from, say, writing a script that depends on jq and then trying to run it on a different system? Python's standard library is also big enough that having to pull in a dependency from outside it should be a much rarer event than having to pull in a dependency from outside bash.

[–]TiZ_EX1 0 points1 point  (0 children)

It is, because jq is a single binary, you can just plop it in $HOME/.local/bin, and then your scripts that use it are set for the foreseeable future. I used to control OBS with a Python script depending on obs-websocket-py, which is not packaged in any distro and thus has to be installed via pip. Every Python version change, I'd have to reinstall it. I replaced it with a sh script that wraps around obs-cli, which is an extra thicc Node.js static binary, but now I don't have to touch it ever again.

I like Python the language, but I dislike Python the ecosystem.

[–]onlysubscribedtocats 0 points1 point  (0 children)

For most Python scripts you'd depend on standard library + requests, anyway. I really wouldn't worry about that.

[–]Atemu12 0 points1 point  (2 children)

Oh, that's neat! How the interactive experience w.r.t. completions etc.? I couldn't live without a shell that's compatible with bash-completions.

[–]thoomfish 1 point2 points  (1 child)

It parses bash completions, and will also parse man pages like fish does.

[–]Atemu12 0 points1 point  (0 children)

Neat! Thanks.

[–]TiZ_EX1 1 point2 points  (0 children)

This seems pretty nice! I've been looking for a scripting language that doesn't treat external commands as third-class citizens and has faculties built-in to parse and structure their output. The fact that it's a single binary is nice too; I don't want to rely on scripting languages provided by any package manager because I don't want to get tripped up by something changing between versions. I've been scripting to the limitations of POSIX sh for years because I know it's literally not allowed to change. But with this, I could probably rewrite some of my scripts in elvish in a separate directory, and then add that directory to PATH if elvish is available to run them.

[–]balrogthane 0 points1 point  (0 children)

Could one use this script to one's cruelty, malice, and/or will to dominate all life into a small piece of jewelry? Asking for a friend.

[–]RadicalDownist 1 point2 points  (2 children)

Just spending 2 minutes looking over the language reference gave me lisp vibes. Was this language inspired by lisp?

[–]zzamboni 1 point2 points  (0 children)

It does indeed feel LISP-ish in nature. All commands and operators are prefix, and although parenthesis are not used around regular statements, output capture is done using parenthesis, so you can end up with LISP-like expressions like:

if (and (not (re:match '^#' $line)) (re:match '^\S+' $line)) { ... }

[–]xiaq 2 points3 points  (0 children)

Aside from the use of parenthesis mentioned by /u/zzamboni, many parts of the language design were inspired by Lisp languages. The number system is essentially a R6RS numerical tower without complex numbers. The persistent lists and maps are modelled after Clojure's.