hachyderm.io is one of the many independent Mastodon servers you can use to participate in the fediverse.
Hachyderm is a safe space, LGBTQIA+ and BLM, primarily comprised of tech industry professionals world wide. Note that many non-user account types have restrictions - please see our About page.

Administered by:

Server stats:

9K
active users

Nushell

Hello world! This is a human-maintained account for Nushell. Thanks Hachyderm for hosting us.

One way to introduce Nushell is using three "pillars" that form the core of the project:
1. Shell
2. Programming Language
3. Structured Data

1/N

1. Shell

Nushell is a shell, so you can use it for usual shell tasks like walking around a filesystem and running commands. We are not POSIX-compatible, however, so some familiar syntax won't work. A big part of a shell is the REPL user experience. For that, we have our own line editor (reedline) and support things like custom completions, syntax highlighting, vi editing mode, etc.

2/N

2. Programming Language

Our goal is to enable growing your one-liners and short scripts into full-scaled programs. This means we had to take a disciplined approach to scoping and mutability, and added features typically found in other programming languages, like modules and types. Instead of functions, in Nushell you write custom commands that are called using the familiar command call syntax with flags, etc. We don't have "eval", like other dynamic languages.

3/N

3. Structured Data

Just like in other shells, commands can communicate via pipes, but instead of text, they share structured data. For example, `ls` gives you a table. Since our commands do not need to (de)serialize data from/to text, it brings us closer to the original Unix philosophy of making "one program do one thing and do it well". It also allows greater interoperability since all commands share the same interface.

4/N

3. Structured data (continued)

Nushell includes converters to/from common formats like JSON or TOML. We have our own object notation, NUON, which is like JSON, but less strict and more compact for tables. In fact, JSON is a subset of Nushell, so any JSON file is a valid NUON and therefore a valid Nushell. We also keep experimenting with more complex data support. Currently, Nushell has plugins for interacting with SQL databases and polars dataframes.

5/N

Nushell also takes cross-platform seriously. The same script should work the same on any platform (except for obvious differences, like `exec`). This sometimes means we have to hold back in our design

And finally, Nushell aims to be friendly and fun! It sure is rough on the edges, which is reflected in the fact that it is still in version 0.x, and maintained by a small team of busy volunteers. Still, we try to do our best to eventually stabilize Nushell and bring it to 1.0.

6/N

@xChaos Python also supports most of JSON syntax, but the keywords (null, true, false) are different. NUON is a 100% superset.

@nushell I already noticed the json syntax differences, occasionally...

I will follow your advances, although my own focus is rather compiled easy to use high-level, dynamically typed language, which would provide much higher performance than interpreted languages, while being much easier to use than Rust or C++ ...

@xChaos Well, Nushell is actually more "compiled" than traditional dynamic languages like Python or JavaScript. We deliberately do not support `eval` which gives us strong static analysis. Nushell's focus remains on scripting, though, but many design tradeoffs are similar to statically compiled languages. It uses gradual typing, similar to TypeScript, but structural, not nominal. Performance is also not great as the focus is getting all the things in place first.