Live data from Hacker News

CoreUtils implemented in pure JavaScript

github.com

101–110 of 128 posts

Re: CoreUtils implemented in pure JavaScript

#101
post #30
post #7

Earlier quoted context omitted.

> UNIX shells suck. Javascript sucks. How could one implement a UNIX shell in Javascript and have it not suck? What do you mean by "UNIX shells suck"? I'm fairly sure most people would consider UNIX shells to be one of the bigger revolutions in computing.

Perhaps it's my own shortcoming, but for any given script I write, I find that, say, 20% of all my code is productive, and the remaining 80% is massaging the output of one tool into a shape that's compatible with the input of the next tool. Compare with the exprience of using Windows PowerShell where cmdlets return objects and you can grab precisely the fields you want with minimum ceremony. Things are better now wit…

I was told XML will solve this.

Re: CoreUtils implemented in pure JavaScript

#102
post #53

Apart from this being of questionable usability, why do people feel the need to solve every problem with (Node)JS? I can think about a ton of languages better suited for systems programming at the top of the hat.

Here is my language-choosing thought process...

Perl/Python/PHP/Ruby: Generally 10x or more slower than V8 Node.js, plus global interpreter lock = automatic no.

C/C++/etc? Fast, but too complex to work with build system / platform compat / 3rd party modules = generally no.

Java? Way too slow startup time; JVM install for users painful = automatic no

Scala/Clojure/etc: Fine languages but same practical problems as JVM languages = automatic no.

Go? Probably nice, but I just don't know it = maybe

Node.js: Fairly fast, easy to debug, fast startup time, easy to use 3rd party code = yes

Rust: safe, C perf, and easy to build and use 3rd party modules via Cargo = yes

Re: CoreUtils implemented in pure JavaScript

#104
post #38

Earlier quoted context omitted.

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 l…

node.js is not simple or even simpler

Using a node script doesn't munge the rest of my shell environment. Cygwin, on the other hand...

Re: CoreUtils implemented in pure JavaScript

#105

Earlier quoted context omitted.

It's better to say nothing so people can be happy with what they've just done and continue to make the same mistakes in the future?

So I guess no one should write a toy kernel again the future, because it won't be perfect? What kind of logic is that?

Toy kernels are usually presented as such.

This is presented as Unix Without the Suck, when in fact it's almost 100% suck.

Re: CoreUtils implemented in pure JavaScript

#106

Earlier quoted context omitted.

I imagine most libraries has some common functions that ones from public API rely on (and of course some exports can be used within module itself). Let's say you never import `helperX` and `helperY` from a library, but you import `usefulFunction` which relies on `helperX`. How would webpack know to exclude `helperY` but not `helperX`? Unless it does some kind of code analysis, or lib is split in "module per function"…

I believe they are doing code analysis, at least that's what the README for Rollup says: > Rollup statically analyses your code, and your dependencies, and includes the bare minimum in your bundle.

I don't think that's possible in all cases:

    var mod = {};
    module.foo = function () { return 42; };
    module.bar = function () { return -1; };

    module[Math.random() > 0.5 ? "foo" : "bar"]();
How can `Rollup` determine that I need both functions here?

Re: CoreUtils implemented in pure JavaScript

#107

Earlier quoted context omitted.

node.js is not simple or even simpler

However, I already have it.

I also have Fortran, Cobol, SWI-Prolog, OCaml, Elixir and Erlang on my computer, so I guess we need to re-implement core utils in these languages too. Using the followings in any technical arguments is just plain stupid:

- it works on my laptop

- but I already have it

Re: CoreUtils implemented in pure JavaScript

#108

Earlier quoted context omitted.

However, I already have it.

Yes, but - when you hit some bug or just need some specific combination of commands, there would be thousands posts on the web that explain how to do on unix that will work in Cygwin. Will they work in this environment?

The question is hypothetical. Sometimes the answer would be yes. Sometimes the answer would be no.

Re: CoreUtils implemented in pure JavaScript

#109
post #7

Earlier quoted context omitted.

I don't understand this at all. UNIX shells suck. Javascript sucks. How could one implement a UNIX shell in Javascript and have it not suck? Does the result suck so bad that it just wraps around becomes good again? Is the "way forward" recombining and rehashing the terrible technologies everyone is familiar with already, indefinitely?

> UNIX shells suck. Javascript sucks. How could one implement a UNIX shell in Javascript and have it not suck? What do you mean by "UNIX shells suck"? I'm fairly sure most people would consider UNIX shells to be one of the bigger revolutions in computing.

Well actually no. I am fluent in several shells (ksh, bash, fish, zsh) but I would not say that UNIX shells are awesome. Most of the CLI tools written for UNIX-like clones are fixing the shortcomings of shells. On the other hand you can do a lot (and I am not even fluent) with PowerShell while not needing a huge "core utils" equivalent on Windows. I used to work for a company that ported PowerShell features to UNIX so we could do lots of things that otherwise would have been impossible or very hard to do only with coreutils + shells. UNIX is old and it has many flaws but it is also wide spread and people think it is "awesome". In fact, if you look to other systems, for example VMS those had better features than UNIX (and clones). Again, I have something like 15+ years on Linux and other UNIX-like clones.

Re: CoreUtils implemented in pure JavaScript

#110
post #30
post #7

Earlier quoted context omitted.

> UNIX shells suck. Javascript sucks. How could one implement a UNIX shell in Javascript and have it not suck? What do you mean by "UNIX shells suck"? I'm fairly sure most people would consider UNIX shells to be one of the bigger revolutions in computing.

Perhaps it's my own shortcoming, but for any given script I write, I find that, say, 20% of all my code is productive, and the remaining 80% is massaging the output of one tool into a shape that's compatible with the input of the next tool. Compare with the exprience of using Windows PowerShell where cmdlets return objects and you can grab precisely the fields you want with minimum ceremony. Things are better now wit…

Could not agree more, best thing that could have happened for CLIs is PS. I wish there was something like that for Linux available today.
Post reply on HN