37

Devs' Thoughts About Types

 5 years ago
source link: https://www.tuicool.com/articles/hit/feqqUfY
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

This week 7 devs made 11 comments about types. Big thanks to all of you!

My Impression

Most commenters favored statically typed languages with type inference which is not a huge surprise.

They argued that types help in auto-completion, documenting interfaces, and catching errors at compile-time. I have to agree about auto-completion but I think interfaces can be documented with decent naming too. I - and some other devs - also boasted that we never ran into type related errors in JS until someone threw in the good old "Undefined is not a function".

Most contra-side commenters mentioned the extra code as the biggest disadvantage of types. They also mentioned reduced flexibility, although I didn't really get answers for my question about cases where changing the type of something helped. I feel like most people think of the weakly typed nature of JS as a time saver, rather than a feature.

Ultimately you managed to make me curious about types. I tried to avoid them because of the extra bloat but maybe I played with the wrong code bases and became biased. I got tired of reading and writing obvious types but I am now excited to try how well a modern type system with inference can help me. A comment about pattern matching in ReasonML piqued my interest the most. I think I will start there.

Thanks for reading!

Next week's topic will be the Virtual DOM . See you on Monday!


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK