
The K8 Javascript Shell - Blahah
https://github.com/attractivechaos/k8
======
javajosh
It would seem that K8 is making the same mistake Sun did with their approach
to cross-platform java libraries. Their first attempts defined a common API
and then they wrote native code to fill in the platform.

This is a bad approach. Better is to a) define a common API, b) generate a
compatibility layer that is as close to the native API as possible, and c)
fill in the gap using platform code (in this case, JavaScript).

Node got b) right, by simply wrapping the posix API in as thin a layer as
possible. If you don't like how file operations are _exposed_ or _organized_
in Node, the right thing to do is to write a library for Node, in JavaScript,
not write another shell!

~~~
euank
I wholeheartedly agree, especially with the "unable to read a line" comment
the author has.

Perhaps he has never seen the "Lazy" nodejs library which lets you simply do
new Lazy(fs.createReadStream("data.txt").lines.forEach(handleLine));

The claim that "other programming languages have ways to read lines" is sort
of true in that many do, but they don't do it significantly more efficiently
than implementing it as above.

Nodejs certainly is minimalistic if you look at the core modules, but the
minimalism does not get in the way of accomplishing the goals the author
describes; rather it simply leaves them up to userland to implement (which
they have been many times).

------
stormbrew
> All the following objects manage some memory outside the V8 garbage
> collector. It is important to call the close() or the destroy() methods to
> deallocate the memory to avoid memory leaks.

This seems... unfortunate...

------
hibbelig
Did anyone else here think this was something like bash or zsh, except that
the commands were in Javascript?

