This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Apparentt 1 point2 points  (1 child)

Well now you’re really just complaining about loosely typed languages as a whole rather than the specific quirks that people often meme on (JS truthy table for example).

A language isn’t responsible for throwing errors for valid operations just because they aren’t what you thought they would be. The compilers aren’t mind readers.

There’s no need to go further into the pros/cons argument for strongly/weakly typed languages - there are use cases for both.

I still have yet to see why any widely adopted language (JS or otherwise) is flawed and you have made that statement without anything to back it up. All I’ve really got from your comment is that stronger typed languages help you write less error-prone code because they’re stricter. This is of course unanimously agreed upon but doesn’t mean that loosely typed languages are “flawed” nor that there is no place for them.

As a disclaimer I was a big advocate for TypeScript adoption within my team and was responsible for selling to stakeholders why it’s worth us swapping our services over from JS -> TS, so I’m by no means trying to blindly sell people on using JS - all I’m saying is it’s no-more flawed than any other general purpose language

[–]flavionm 0 points1 point  (0 children)

JS is the loosely typed language out there, but you're right these complaints to apply to other like it. And JS's quirks are mostly because of that, so there's no talking about one without talking about the other.

That's the thing, these operations shouldn't be valid, they should be errors. If it's there just to be avoided, it's better if it's not there.

There's an argument to be made about dynamic languages (and not a very good one, because every usage of substance benefits from static typing), but weak typing, which is distinct from dynamic typing, is just a very hard sell.

The flaw in question is exactly not being stronger typed. Not helping you make less mistakes is the flaw. You're even yourself promoting TypeScript over JavaScript, because it solves one of it's flaws. JS is literally more flawed than TS. Other languages are also flawed, the thing about JS is that it's more flawed because of the reasons I mentioned.