DEV Community

Discussion on: Remembering that "functions are objects" can help in writing more concise code

Collapse
 
nssimeonov profile image
Templar++

Now read the title again... slowly...

This is what is wrong with JavaScript and why developers are making fun of it

Collapse
 
somedood profile image
Basti Ortiz

Indeed, JavaScript is a (very) flawed language. Indeed, JavaScript is a laughing stock for "real programmers" who code with more hardcore, lower-level languages. JavaScript was designed in just two weeks after all. I don't blame the community for belittling JavaScript despite its success and omnipresence nowadays.

However, I beg to differ on how you believe JavaScript's treatment of functions as objects is wrong. There is no right or wrong in programming languages. Each language was designed to be how it is for a good reason. It is unfair to say that a language feature is "wrong" because it is rare or unpopular.

Let's take Rust for example. Variables in Rust are immutable by default. Most languages are not designed that way. Would it be fair to say that Rust is "wrong" for having immutable variables by default? I wouldn't say so.

I hope you see my point here even if my analogy might be off. I don't mean to attack you or anything. Sorry if it comes out like that. I just felt the need to defend the language I love, you know?

Collapse
 
nssimeonov profile image
Templar++

Don't take everything too serious :) You know - there are only two kinds of programming languages: those people always bitch about and those nobody uses.

Modern days JS has evolved a lot, compared to what it used to be back then, when Brendan Eich designed it. And we all why he did this.

As an older generation programmer and someone who used to think how everything represents in memory and what instructions the CPU has to execute, I understand what you mean. In fact what you refer as object is actually a pointer - some data and function reference... and to be more precise it's is even more than actually an object - it also contains the closure with all the surrounding variables of it's parent functions/objects/closures... Heck even trying to explain that can bring me a headache...

Anyway - JS has a lot of issues and a lot of good parts. And for some of the issues TypeScript can actually help and I'm happy to see that one of the best people in our time - Anders Hejlsberg is working on it.

Thread Thread
 
somedood profile image
Basti Ortiz

Ah, I see. Thanks for clearing stuff up. Again, sorry if I came out too aggressively.

*This is off topic, but I should really start learning TypeScript. I'll make that my goal by the end of the year.
**Also, you have my +1 Respect for your experience with low level programming. I'm relatively new to all of this (having three years of experience), which is why I find that really cool.

Thread Thread
 
nssimeonov profile image
Templar++

20 years later and you will be tired of all this s*** and everything new will sound like re-inventing the wheel once again but slightly differently, yet it's still a wheel :) Keep up the enthusiasm and learn new things.

Oh yes, and don't apologise! I didn't notice any aggression in your reply anyway, but even if there is - some of us are calling it passion and don't find anything wrong with this.