DEV Community

Discussion on: JavaScript is not an untyped language

Collapse
 
mistval profile image
Randall

JS has types and the simplest proof is the existence of the typeof operator. Still, if someone says JS is untyped, I'll know what they mean and won't do a "well akshually ..." because it's unproductive and pedantic.

Collapse
 
peerreynders profile image
peerreynders • Edited

because it's unproductive and pedantic

You have to be careful. Being too accepting of "you know what I mean" can easily cascade over time into communication that is so ambiguous that it is useless.

Like it or not, as software developers we have to communicate effectively with our colleagues and machines. With machines for the most part we stare at a syntax error or unit test run time error (if we're lucky) when we are imprecise or plain wrong.

The presumably self-correcting nature of communication among colleagues is at best unreliable. Too many times I've seen two parties agreeing with one another simply because they were hearing what they wanted to hear, not what was actually being said.

This is why for example in DDD ubiquitous language is so important.

So the trick is to correct in the service of keeping communication as accurate as possible without being pedantic about it and being tolerant of the fact that at times we all make mistakes.

Just yesterday in the context of JSX I was talking about markup 🤦.

Collapse
 
mistval profile image
Randall

There's no avoiding misunderstandings, they can happen regardless of how precise your language is. There are times when correcting someone can be beneficial, and other times when you're just telling them things they already know, not doing anyone any good, and looking pedantic. Ultimately, that's a judgement call based on the unique circumstances of the situation. If someone says "JS doesn't have types", I think it's extremely likely that they are in fact aware that JS has strings, numbers, null, and undefined. There may be times when launching into a detailed explanation about it is helpful, but most of the time it's probably not.

Thread Thread
 
peerreynders profile image
peerreynders

I think there's also cultural issue; "correction" as a means asserting superiority but I think we need to move beyond that.

And perhaps in lieu of a "detailed explanation" sometimes it may make more sense to ask some questions in order to establish whether certain assumptions are actually shared.

Collapse
 
miguelmj profile image
MiguelMJ

You're right. Just notice that my problem arises when some people are telling beginners that there are no type errors in JavaScript and that's a good thing.