Live data from Hacker News

CoreUtils implemented in pure JavaScript

github.com

31–40 of 128 posts

Re: CoreUtils implemented in pure JavaScript

#31

>Huh? Okay - think Cygwin, except: Oh boy, another one of these. Cygwin is useful because it provides a POSIX C API on Windows. It is not useful because of its shell and coreutils. And saying it uses "pure ES6" is stretching it - it's using the plain ES5 Node.js require/export patterns instead of ES6 modules. >1/15th of the size [of Cygwin] Haha, and 1/100th the functionality

Cant upvote you enough....

Also... Node... Huh? seriously? replace a siongle DLL with Node.JS is simplifying it??

Re: CoreUtils implemented in pure JavaScript

#33
post #16
post #8

Earlier quoted context omitted.

Some people would agree with both statements. UNIX shells are amazing and the recent improvements in their UX and environment integration is great. (git repo status, programming environments, intelligent completion, the whole of oh-my-zsh, ...) But as soon as you want to do anything moderately interesting, it's better to grab a real programming language, because UNIX shells suck. Escaping failures, whitespace handlin…

The next step up would then be a REPL shell. As much as I love the idea of us running Lisp machines, at least $SHELL has a moderate enough learning curve that both beginners and experts can exploit many of it's features. Plus while many (most?) of us are programmers, there are quite a number of administrators who don't enjoy coding or even can't code at all. $SHELL is entry level enough that even they can chain a few…

Unix shells are notoriously not user friendly. The commands and their interfaces are full of insonsistencies and often really strange. Reading man pages is horror.

The shell languages are not much better.

There are some useful concepts, but in general Unix shells are used despite their user unfriendliness.

The shells of the various Lisp Machines were quite different. The Symbolics shell, later called Dynamic Lisp Listener was quite nice on the GUI side and the management of commands, completions, defaults, interactive help, etc..

See for example: https://www.youtube.com/watch?v=o4-YnLpLgtk

The interactive help of that Lisp Machine OS is quite a step up from what any typical shell offers. Though it was mainly developed for single user machines with powerful GUIs.

The problems of that approach: it wasn't very sophisticated on the text terminal - actually it was quite bad. The whole UI mostly assumed a GUI. For development one needed an extended Common Lisp (or Zetalisp), which is a bit too complex for many users.

See also a video I made long ago about the user interface of Symbolics Genera, the operating system of the Symbolics Lisp Machine line of personal workstations.

https://vimeo.com/159946178

Re: CoreUtils implemented in pure JavaScript

#34

Earlier quoted context omitted.

Because the shell has a lot of room for improvement. Try powershell for a bit. Look at its design, look at the things it can do that the unix shell has problems with. Everything's an object. Instead of passing lines of text, you're passing objects, with properties, types, etc. This becomes important because of Library files are first class citizens. Because the shell is string based, you have to wrap everything up in…

Powershell is a great programming language an not a bad shell in and of itself, but using it in the same manner as a shell is quite painful. I tried to rewrite some of my ksh stuff in Powershell after getting a job at a mostly Windows-only shop. Basically every ten-line function ended up into a fourty-line superthing that's subtly incomprehensible to anyone who doesn't know .net. I get why Powershell is great for sys…

From my own experience learning bat scripting then sh scripting and then powershell, the 40-line monstrosity is what happens when you first learn another scripting language. Sometimes the paradigm can be so different that simply trying to port one script to another language ends up being more difficult (but better, from a learning standpoint, for me) than simply starting over.

Re: CoreUtils implemented in pure JavaScript

#35
post #17

Earlier quoted context omitted.

Yes, I don't understand it either. "No ugly DLLs" but you have to run everything in Node.js. There are a few technologies that have tried to do something better than Unix shells, like Microsoft's PowerShell. It has a lot of failings, but it gets a lot of things right. I am always stunned when I see Windows folks stumbling around in cmd.exe when PowerShell has been installed standard for a while now. There's still a l…

I use cmd a lot more than PS because: 1. Win+R -> cmd enter is a lot faster than Win+R -> powershell enter 2. cmd starts faster than powershell 3. I seldom require all the power from powershell

I napped CTRL+ALT+T to start powershell. Very convenient.

Re: CoreUtils implemented in pure JavaScript

#37
post #16
post #8

Earlier quoted context omitted.

Some people would agree with both statements. UNIX shells are amazing and the recent improvements in their UX and environment integration is great. (git repo status, programming environments, intelligent completion, the whole of oh-my-zsh, ...) But as soon as you want to do anything moderately interesting, it's better to grab a real programming language, because UNIX shells suck. Escaping failures, whitespace handlin…

The next step up would then be a REPL shell. As much as I love the idea of us running Lisp machines, at least $SHELL has a moderate enough learning curve that both beginners and experts can exploit many of it's features. Plus while many (most?) of us are programmers, there are quite a number of administrators who don't enjoy coding or even can't code at all. $SHELL is entry level enough that even they can chain a few…

The harmonization I've come to for "shells are awesome" and "shells suck" is that interactive usage and non-interactive usage are too different to be fully covered by one tool (i.e., you can occasionally cross over for small tasks but only very small ones). In particular, it's the error handling. Interactive error handling by a human in the loop and fully engaged vs. error handling in a program are too fundamentally different.

In both cases, for small uses, you can stretch your shell or REPL or programming language over to the other case, but for long term use it's just not practical. After all, in theory many languages have REPLs that could have long since replaced shell, but only a handful of very dedicated people actually replace their shell with a REPL for some language. I've tried, and I can't do it, even with shell support libraries in the relevant language.

The suckiness of UNIX shells is mitigated if you view them as "the tool optimized for interactive usage". And once you let them be that, they really aren't so bad. It's only if you try to force them to be programming languages, especially past a couple dozen lines or when they try to do something other than just run lots of commands pretty much blindly, that they become really bad.

Also complicated quoting is a pain, but as a percentage of the number of commands I run in my shell, they aren't that large, they just loom large in my memory. Run history and really look at what you're doing day in, day out with your shell. Unless you've got a really crazy usecase, there's a lot of things like "ls" followed by a "cd dir" and such. It's part of why I can't get into REPL replacement; replacing "cd tmp" with even "cd('tmp')" is, percentage-wise, a huge increase in keystrokes. (And don't forget, the space is much cheaper than left paren; the space bar is huge and I basically have an entire digit dedicated to it, whereas left paren is two not-on-home keys at the same time.)

Re: CoreUtils implemented in pure JavaScript

#38

>Huh? Okay - think Cygwin, except: Oh boy, another one of these. Cygwin is useful because it provides a POSIX C API on Windows. It is not useful because of its shell and coreutils. And saying it uses "pure ES6" is stretching it - it's using the plain ES5 Node.js require/export patterns instead of ES6 modules. >1/15th of the size [of Cygwin] Haha, and 1/100th the functionality

Simpler is better.

Cygwin is overkill unless you are trying to mimic your exact non-Windows environment, and it doesn't mix well with Windows' vanilla CMD environment. For those of us who want to be working with more Windows than UNIX, but who are used to standard coreutil commands, 1/100th the functionality of cygwin actually sounds kind of great!

Not saying that the commands need to be written in JS, but it seems like every language gets at least one coreutils implementation, so why not?

So much negativity around here. Honestly I find it pretty neat that JS has come this far.

Re: CoreUtils implemented in pure JavaScript

#40
post #8

Earlier quoted context omitted.

Some people would agree with both statements. UNIX shells are amazing and the recent improvements in their UX and environment integration is great. (git repo status, programming environments, intelligent completion, the whole of oh-my-zsh, ...) But as soon as you want to do anything moderately interesting, it's better to grab a real programming language, because UNIX shells suck. Escaping failures, whitespace handlin…

If someone were to make a distro with powershell instead of the unix shell I'd lose my mind.

i haven't really used PS, but from what i understand you'd also need to rewrite every other program to adhere to its rules. as - if i understood it correctly - the real benefit of powershell is that they all use the same output format. this decreases the trouble of handing output from one command to the next significantly.
Post reply on HN