Hacker News new | ask | show | jobs
by diego_sandoval 756 days ago
I thought it was going to be about JS and npm, given some of their fiascos [1][2][3]

[1] https://qz.com/646467/how-one-programmer-broke-the-internet-...

[2] https://www.bleepingcomputer.com/news/security/dev-corrupts-...

[3] https://www.sonatype.com/blog/everything-matters-why-the-npm...

1 comments

`this` was mostly prevented in JS with the introduction of arrow function expressions
I had someone on Reddit r/webdev try to convince me that 'this' was not a mistake but a powerful language feature. A small glimpse into the mind of JS fans.
Sounds like something any programmer would say about their preferred language. Can't say you don't hear similarly crazy things about C, or C++, or Java.
True. But it's generally only common with older C-based languages where the goal was packing as many features as you can instead of high level design aimed to guard software from inexperienced overeager devs.
It kinda is a powerful language feature But with great power comes great responsibility, and that doesn’t mean it was a good idea in hindsight.
Yes, it's functions vs methods. You can make this explicit like in Python, you can make it implicit but have two kinds of methods, instance methods and static methods like in C++/C#/Java.

And you have JavaScript were all functions have an implicit this ...

If it didn't exist, people would come up with weird hacks to implement the few cases where you do need it. But those are rare.