Hacker News new | past | comments | ask | show | jobs | submit login
NGS – Next Generation Shell (ngs-lang.org)
41 points by phonebucket on Dec 10, 2021 | hide | past | favorite | 29 comments



This seems to be more a simple programming language than a shell. A shell is first and foremost a UI, only secondarily a scripting language... That is the point, that you can easily take a series of commands you'd do manually and put them in a script.


Hi!

Author here.

> This seems to be more a simple programming language than a shell.

Currently it's only a programming language. The interactive part will be implemented in the NGS language itself.

> simple programming language

Since simple is relative: NGS is simpler than Java and more complex than awk I would say. NGS has exceptions, types with inheritance, multiple dispatch, guards (additional conditions to invoke a method), basic functional programming support, patterns, (new, in progress) facility for deeply nested data manipulation, automatic parsing of command line arguments when invoking the optional main(), threads, domain-specific syntax and facilities for running external programs and file manipulation.

Simplicity is one of the language goals but not over expressive power.

> A shell is first and foremost a UI, only secondarily a scripting language...

I'm having hard time to agree or disagree. There is a lot of interactive usage but there are also a lot of scripts in bash. When I see the scripts I wish bash was "more of a programming language".

> foremost a UI

... where surprisingly little innovation happened over the last decades. It's like in the movies when there is an object in the center of the screen and the whole world is rapidly changing around it. That object is the shell. My plans for UI are at https://github.com/ngs-lang/ngs/wiki/UI-Design .

> easily take a series of commands you'd do manually and put them in a script

You can do it in NGS and even in this simplest use case it will be better than bash - in case of an error the execution will stop (like with -e in bash) and NGS will print stack trace (which I don't know how to do in bash and not sure it can be done in a sane manner).

Edit: $a will expand to exactly one argument (as opposed to zero or more), rm -rf "$mydir/" will throw exception if mydir is undefined. Typical things which are expected from modern programming languages.

NGS uses small subset of syntax from bash so running external programs in the simple forms looks the same.


Hello!

Author here. AMA here or in Discord - https://discord.gg/6VqgcpM


I'm still on zsh most places, but I'm always happy to see new shell projects like oil and elvish. This is my first time hearing of this one.


It still misses the ability to call shared libraries entry points or interoperate via OS IPC (UNIX, D-BUS,...), if I am reading the documentation correctly.

So not so much next gen.


I don't have an opinion on the particular product. But I don't understand people who call a product something starting with "Next Generation". Such a name isn't really going to age well no matter how clever you are.


"Please don't post shallow dismissals, especially of other people's work. A good critical comment teaches us something."

https://news.ycombinator.com/newsguidelines.html


Why not ? After "Next Generation" comes "Deep Space 9".


I remember when sufficing something with "2000" made it look futuristic... I guess that didn't age well either.


next gen 2k quantum blockchain


Just like xyz-ng has become the mark born by early 00s replacements for early 90s tools.


Worked for Windows NT (NT = New Technology). Used to see a lot of ads "... built on NT technology"...


The "new NT technology"


Why not? It's not like he called it the Millennials Shell or Generation Alpha Shell.


Mega Shell Plus


(next)+ generation.


Next Generation Shell is called Powershell


I tried to like PowerShell, but found it unpleasant to use as a shell or scripting language.


There are multiple, perhaps even many, next gen shells. PS is one, but it's not the only thing and shouldn't be.


Sure

but it's the only widely used portable one which goes beyond just passing bytes. It has powerful object model with passing object handles around.


So I'm a little out of the loop, but doesn't the nice object system fall apart once you use that portability, since only NT uses objects over bytes?


> but doesn't the nice object system fall apart once you use that portability

no

e.g., directory listing returns handle to the object with IEnumerable interface. This is what would be passed through the pipe, not bunch of strings, such that next command (object) will iterate over files and do something specific.

This will work on Windows/Linux/Mac the same way

> only NT uses objects over bytes

Modules. There are generic portable modules as well as NT specific stuff.


I was excited when I saw the features like retry and timestamps in log.

Then I saw it was written in C. I actually thought it would be Rust or Go. I don't think you should use C for a "next generation" thing.


I avoid the rather uesless "Why not?" comment as it will naturally spark answers like immutable data structures, sane type model etc.

Whole and profitable empires have been built with C. C compilers are darn good in optimizing code. There is a large workforce proficient in C.

I would bet anytime on C rather on Rust. If Firefox will die it's because some overly eager (but certainly smart) people thought a rewrite will solve business problems.


> If Firefox will die it's because some overly eager (but certainly smart) people thought a rewrite will solve business problems.

Rust is probably the least terrible business decision to come out of Mozilla in those past 5 years. If Firefox dies it will be because of the executive's rent-seeking behavior.


> I would bet anytime on C rather on Rust. If Firefox will die it's because some overly eager (but certainly smart) people thought a rewrite will solve business problems.

That would be ironic given that a massive rewrite is what tanked Netscape, and gave rise to Mozilla, and eventually Firefox.


> Whole and profitable empires have been built with C. C compilers are darn good in optimizing code. There is a large workforce proficient in C.

Then why is it that all of the major C compilers are written in C++?


If it works it works. Very few of my problems with shells can be blamed on C. (Maybe two in total?)

The oldest commit is from 2013. Rust hadn't hit 1.0 yet, Go only barely.


Here is a bit of history which might shed some light on the decision.

First and very partial implementation - JavaScript. It was a prototype which I knew I will be throwing away... and I did.

Second attempt, also very partial - Lisp. I used SBCL. Skipping the details here but the result was as follows: got stuck with two different unrelated issues. I did not know would I be stuck with additional issues even if I somehow solve these two.

Third attempt - found a language in which I will never be stuck unable to solve something. C. Also, looked around: bash, Python, Ruby - they are all C. At the time I thought I might be "borrowing" some code from. It didn't happen. I did look though.

Edit: unexpectedly a huge chunk of work, which is garbage collection, was already done for me. C has garbage collection! It is a library - https://en.wikipedia.org/wiki/Boehm_garbage_collector




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: