Hacker News new | ask | show | jobs
by lhnz 3627 days ago
Perhaps there are features from other programming languages that should exist in shell programming?

For example, I've always felt that the fact that almost everything in shell programming is a gigantic string is really bad. It would be much nicer if all commands had type signatures, and therefore piping commands into each other could throw type errors if it does not make sense.

This would also allow much better feedback when stringing together commands, since the shell IDE would be able to recommend commands that act upon a particular type. For example, if a command produces output that could be considered to be N > 1 lines long then `wc -l` would be available, however if this isn't the case it does not make much sense for it to be recommend to the user.

2 comments

I'd suggest reading http://www.catb.org/esr/writings/taoup/html/ to better understand why UNIX is the way that it is.
I've read it before.

So I know that:

> Write programs to handle text streams, because that is a universal interface

But I also think that:

> To build it out of simple parts connected by well-defined interfaces.

Many text representations are vastly different, and neither simple or well-defined.

The interface is not necessarily the content of the message conveyed by the interface. Lines of text std(in|out) is a well-defined interface. Some programs may go further and specify the format of messages passed on that interface. https://github.com/synacor/dtk is one such system that specifies (for most of its commands) tab-delimited records as the message format. It interfaces well with other elements of the UNIX ecosystem, however, because its interface is simply lines of text on std(in|out).
Like in PowerShell?
I've not used it before and I presume it is Microsoft Windows only.