Hacker News new | ask | show | jobs
by epgui 766 days ago
Personally, I'd argue that I don't find OO to be desirable in a shell anyway. The future is FP for almost everything.

(This is a really neat tool, great work!)

2 comments

Unix shells are already a bit LISP-y on a superficial level, because commands are syntactically like impure functions in prefix notation. Subshells act a lot like parens in a LISP, and the pipeline itself has analogs in FP like Clojure's thread macro. And of course, the command line itself is a REPL.

Elvish visibly leans into this to try to have a consistent syntax. Sometimes the similarities go deeper, too; IIRC, its number types are inspired by Scheme, for example.

> Elvish visibly leans into this to try to have a consistent syntax. Sometimes the similarities go deeper, too; IIRC, its number types are inspired by Scheme, for example.

Yes! Similarity to Lisp is very much a deliberate design choice and I feel happy every time a Lisper picks that up :)

I believe Elvish has also contributed a novel solution to the Lisp-1/Lisp-2 divide by making the space of command names equivalent to the subspace of variable names with a suffix - the command "foo" is equivalent to the variable "$foo~" and vice versa. (There's a bit more twist than that - the command "foo" can also resolve to the external command named "foo", but then that's represented by the "$e:foo~" variable.)

Powershell is closer to FP than OOP. What people mean is that it supports structured data.

Powershell is not true FP, but, if you stretch terminology:

- the unit of feature delivery is the function - you can pass functions as values (but it's not idiomatic or elegant) - objects tend to look more like anonymous records than OOP classes with methods - pattern matching is supported (sort of)