News for hackers. Stuff that matters.
Re:Elvish, expressive programming language and a versatile i... by sidkshatriya on Friday May 10, 2024 @04:31AM (#40316620)
I like Elvish. It's clean, consistent and stable. Writing a shell script in Elvish is so much more productive and simpler than, say, bash. There are are also fewer pitfalls and tricks you need to master.

The Elvish shell language doesn't change much which is nice nowadays. The Elvish executable has also got a built-in lsp which is another nice touch.

Finally it is a "proper" shell because it has job control (which other new age shells like nushell don't).

P.S. I like nushell too which has got more features, is more powerful but is still evolving. Maybe in a couple of more years it will stablize like Elvish already has. There are lots of similarities between Nushell and Elvish scripting language. I would recommend either of them.

Re:Elvish, expressive programming language and a versatile i... by xiaq on Friday May 10, 2024 @06:03AM (#40317109)
Hey, thanks for the compliment! Glad you've enjoyed Elvish.

Re job control - you can run a background job with &, and there are fg and bg commands, but you can't actually ^Z a running program (which is what most people mean by job control). I've heard people have success with https://github.com/yshui/job-security though.

Re Elvish and Nushell, I'd add my biased recommendation for Elvish because it has comprehensive reference documents (https://elv.sh/ref/) :)

Re:Elvish, expressive programming language and a versatile i... by mst on Friday May 10, 2024 @06:49AM (#40317381)
I'm afraid I really need ^Z, %-, %3 and %foo for interactive use.

See e.g. the top-right xterm in https://trout.me.uk/screenshot3.jpg for why.

Tried to switch to a ksh for a while and ran face first into that, though OpenBSD ksh has added it so I may attempt that one at some point.

(tabs don't fit my brain nearly as well and https://github.com/n-t-roff/heirloom-ex-vi is my usual editor and doesn't provide anything of that ilk anyway ... I may be an outlier ...)

The syntax and semantics seem really rather nice though, I may attempt elvish for scripting at some point.

Re:Elvish, expressive programming language and a versatile i... by xiaq on Friday May 10, 2024 @07:56AM (#40317856)
I have a ton of respect for whoever sticks to the traditional vi! Not promising anything but this may have bumped the priority of supporting ^Z slightly in my TODO list :)
Re:Elvish, expressive programming language and a versatile i... by mst on Friday May 10, 2024 @09:27AM (#40318721)
Also useful for jumping back and forth between e.g. multiple repl sessions (the re.pl on the top left is a readline frontend wired up over a socket to an p3rl.org/Eval::WithLexicals instance running inside the server I was debugging there).

Being able to do e.g. %Task to resume the lib/.../Task.pm editor is -really- nice once you have that many editors open, though I try and stick to about 5 per xterm normally so %- %+ %<digit> would absolutely be enough to get started with.

Re:Elvish, expressive programming language and a versatile i... by tambourine_man on Friday May 10, 2024 @07:35AM (#40317711)
Traditional Vi? I thought I was hardcore. Certainly an outlier, in a good way :)
Re:Elvish, expressive programming language and a versatile i... by mst on Friday May 10, 2024 @09:19AM (#40318636)
If I'm on somebody else's system and need to hit the ground running Right Now then this comes into play instead - https://trout.me.uk/X11/vimrc (I think it's been a few years now since I've been annoyed enough by something in vim to figure out how to turn it off and add yet another line to that ;)
Re:Elvish, expressive programming language and a versatile i... by nocman on Friday May 10, 2024 @11:04AM (#40319884)
Out of curiosity, why bother to unmap the cursor keys? I don't ever use them in vim either, but is there something that is prevented from working with having them mapped in vim?
Re:Elvish, expressive programming language and a versatile i... by baobun on Friday May 10, 2024 @05:03PM (#40323769)
It can be useful to crush old habits.

Also very useful if you do a lot of context switching or are an occasional user, to make sure your brain and fingers are in "vim mode" (at least one other line in the file makes this rather obvious)

And once it's there, why bother removing it? I think you are in minority if you actively prune your vimrc for dead config...

Re:Elvish, expressive programming language and a versatile i... by mst on Saturday May 11, 2024 @02:22PM (#40329760)
I never had those habits, though I have passed that stanza on to people who were just learning to help remind them to use hjkl.

I just tend to turn off things I only ever hit by accent (see also the :h override).

Re:Elvish, expressive programming language and a versatile i... by mst on Saturday May 11, 2024 @02:21PM (#40329750)
Because I don't ever hit them except by accident while using vi(m) so disabling means an accidental keypress does nothing rather than something I didn't want.

(my main reason for preferring original ex-vi is that when I typo a command, it beeps at me, whereas in vim the typo is usually some completely unrelated but valid command sequence and then WTF JUST HAPPENED and argh)

Re:Elvish, expressive programming language and a versatile i... by ramses0 on Friday May 10, 2024 @11:09AM (#40319948)
Clever w.r.t. "job control as task-switcher". The absurdity of that statement being clever kindof stares you in the face a bit, huh? Don't forget ^T for SIGINFO: https://en.wikipedia.org/wiki/Signal_(IPC)#Sending_signals
Re:Elvish, expressive programming language and a versatile i... by sidkshatriya on Friday May 10, 2024 @06:24AM (#40317215)
The documentation of Elvish is indeed top notch. I also like the self contained nature of the project. Elvish is like a beautiful tool in your arsenal while nushell is a powerful but perhaps too feature-full scripting language.

An imperfect analogy: Elvish is like a compact OCaml while nushell is more like a Haskell or C++ of the scripting world !

Re:Elvish, expressive programming language and a versatile i... by hnlmorg on Friday May 10, 2024 @07:37AM (#40317722)
Murex has had job control support for literally years too.

There’s actually a lot of parallels between murex and Elvish. Both projects started around the same time, both written on Go. Both support structured data and smart data types.

The syntax differs a little between them two but concept wise they’re similar in a number of ways. I as (project author) just don’t do a particularly good job promoting murex. In part because I’d never want to force my own shell preferences onto others.

But It’s good that there’s so much choice these days and people aren’t stuck with the archaic decisions of the 70s

Re:Elvish, expressive programming language and a versatile i... by xiaq on Friday May 10, 2024 @07:50AM (#40317807)
Hiya! I, for one, would definitely welcome more promotion of Murex!

(Also just checked out Murex's website again, seems we reworked the style of the respective homepages around the same time :)

Re:Elvish, expressive programming language and a versatile i... by hnlmorg on Friday May 10, 2024 @09:45AM (#40318919)
Your new website is nice. Particularly on mobile too, but even just generally. Though to be fair, I've always been impressed with your website layout -- even on the previous one.

I can't take any credit for Murex's site, it was a user who doesn't write Go but wanted to contribute in other ways. Open source is definitely a double edged sword but I'm still always surprised and impressed with how much time people are willing to invest into other peoples projects if they like them.

By the way, one killer feature of Elvish that I admire and think doesn't get talked about enough is how exceptions are raised in pipes. eg:

    ~> cat example | grep foo | grep bar
    Exception: (<nil> | grep exited with 1 | grep exited with 1)
It's really neat how you do that. It's readable, detailed, and valuable to the user.
Re:Elvish, expressive programming language and a versatile i... by xiaq on Friday May 10, 2024 @10:09AM (#40319211)
Thank you for the compliment!
Re:Elvish, expressive programming language and a versatile i... by wg0 on Friday May 10, 2024 @07:50AM (#40317809)
> does not change much so you mean no async await, no union types, no type hinting, no lambdas etc etc.

Kidding, I'll give it a try. Can it replace one's shell as daily driver?

Re:Elvish, expressive programming language and a versatile i... by xiaq on Friday May 10, 2024 @09:42AM (#40318880)
Yes! I haven't been using it as my daily driver for almost 10 years now.

There are detailed instructions on how to get it and use it as your default shell in https://elv.sh/get/.

Re:Elvish, expressive programming language and a versatile i... by nocman on Friday May 10, 2024 @11:07AM (#40319917)
> I haven't been using it as my daily driver for almost 10 years now.

Is there some humor I'm missing there, or is that just a typo (and you meant to say "I have" )?

Re:Elvish, expressive programming language and a versatile i... by xiaq on Friday May 10, 2024 @11:46AM (#40320348)
Ha it's just a typo.