Hacker News new | ask | show | jobs
by zyngaro 3558 days ago
So you're saying bower is cancer? Webpack is cancer? Babel is cancer ? JavaScript module system made popular by nodejs is cancer? I largely prefer Python as a language but Nodejs is the best thing that happened to web development in years/ever
2 comments

> So you're saying bower is cancer? Webpack is cancer? Babel is cancer ? JavaScript module system made popular by nodejs is cancer?

So I write a ton of JavaScript including plenty in node. But make no mistake bower, webpack, babel and npm are all crap. They're hacks. Bandaids to make ES6, the web and JavaScript modules packaging and installation work correctly. They all have their own issues, huge dependencies (I mean holy crap it took me several minutes to install Babel last time I did it all just so I can use slightly different syntax and deal with map files? ugh).

No, they are (well developed) bandaids to help deal with the cancer of javascript!
I'm not convinced it's that they aren't just more layers of cruft piled on top of a shoddy foundation. One of these days the whole thing is going to subside into the morass, and maybe we'll get to start over on top of WebAssembly or whatever comes after that.

It's like the castle in the Holy Grail:

  When I first came here, this was all swamp. Everyone said I was daft 
  to build a castle on a swamp, but I built in all the same, just to 
  show them. It sank into the swamp. So I built a second one. That 
  sank into the swamp. So I built a third. That burned down, fell 
  over, then sank into the swamp. But the fourth one stayed up. 
  And that's what you're going to get, Lad, the strongest castle in 
  all of England.
Hurray, here we go again! Uhh no, JavaScript is just fine, baring:

* implicit conversions, which you can get rid of at compile time using TypeScript or Flow.

* lack of explicit ints and ints with more than 31 bits (JITs can give you SMIs, or 31 bit integers for things they can prove are always integer values)

And thats about it.

> implicit conversions, which you can get rid of at compile time using TypeScript or Flow.

Javascript is fine if you don't use Javascript.

> lack of explicit ints and ints with more than 31 bits

Javascript is fine, except where it's garbage.

I don't really have a problem with javascript. I just don't want to build anything of any real complexity with it.

What I'm saying is that JS actually has a small amount of quirks compared to other dynamic languages. Just think about PHP's named functions, which are always in the global scope. Except when they are in namespaces (oh hi another concept), and then its kinda weird because namespaces are relative. There are no first class named functions, but function expressions can be assigned to variables. Which must be prefixed with $. There are no real modules, or proper scope; JS in turn implements modules cleanly on top of closures with lexical scope and objects.

In ruby, blocks are like lambdas except when they are not, and you can pass a block explicitly or yield to the first block implicitly. But there are also lambdas, which are different. Modules are again uselessly global, and cannot be parameterised over other modules (without resorting to meta programming). Oh yeah they are also another syntactical and semantical concept. Why not just `Module.new`? And there are classes, with private variables, which are prefixed with @.

The above examples are just scratching the surface

So yeah, I'm tired of people claiming that JS has the same amount of quirks as PHP. Boo hoo, its so horrible: no large ints, and implicit conversions. Compared to that, Ruby, PHP or (god forbid) Perl < 6 are total disasters. Pre-ES6, JS had the greatest power-to-number-of-concepts ratio of all current mainstream dynamic languages (1). With just prototypes, closures and objects, it manages to provide features that other languages do not with a dozen of base concepts

(1) cheating a bit here, because you could argue that Lisp or Lua are mainstream enough.

So how exactly is a comparison of JS/PHP/Ruby relevant in a dicussion about a tool rewritten from JS to Python?
It debunks the mistaken popular belief that JS is somehow a significantly worse language.

Also, I can't help but wonder how this: http://docs.python-guide.org/en/latest/dev/virtualenvs/ is somehow better compared to npm...

Your comment was about nodejs not JavaScript. Also give es6 js a try. It looks and feels like coding in Python (almost).