DEV Community

What the hell is type-safe language?

Visakh Vijayan on November 14, 2018

Consider you are a compiler. Now suppose you are a person who doesn't care about your fellow programmers who are writing code and using you to get ...
 
s_anastasov profile image
Stojan Anastasov

I never said you would write 0 unit tests. You would write no tests for types.

Kotlin has nullability built into the language, so I don't have to write a test what happens when the variable I am passing is null.

I also don't have to do defensive programming and check if the variable is null.

Collapse
 
s_anastasov profile image
Stojan Anastasov • Edited

Well, you could have the compiler verify the types for you or write unit tests instead..

How else do you make sure the function expecting a User doesn't get a Monkey instead?

Collapse
 
fpuffer profile image
Frank Puffer • Edited

What does dynamic typing have to do with "Divide by zero"? Zero is a value, not a type. Statically typed languages won't prevent division by zero.

Collapse
 
camto profile image
Benjamin Philippe Applegate

True, unless you have refinement typing!

Collapse
 
vjnvisakh profile image
Visakh Vijayan

True ... that was a mistake. Thank you for pointing it out.