DEV Community

Discussion on: Convince me that types are awesome

Collapse
 
cathodion profile image
Dustin King

The uses I see for types are:

  • a form of unit test
  • an optimization hint
  • something you use for when you want to do different operations on different kinds of things (aka polymorphism)
  • a form of inline documentation

Even dynamic languages have had polymorphism in the form of classes for a long time, and lisp has had typecase and now multimethods.

I think it's good that types are becoming available in dynamic languages, but I think using them will in most cases make code more verbose, and should therefore be used sparingly.