3 ms·
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.
by alternatex 2y ago
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.
- orf 2y agoIt 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.
- _old_dude_ 2y agoYes, 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 ...
- pjc50 2y agoIf 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.
- xboxnolifes 2y agoSounds 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.
- alternatex 2y agoTrue. 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.