Things I Was Wrong About: Types
To play against the current wave, and give a contrarian pov:<p>I&#x27;m grown up with statically typed languages from C&#x2F;C++&#x2F;C#&#x2F;Java and later and didn&#x27;t know about dynamic languages till recently.<p>1. Which types are we talking about?<p>- In earlier static-typed language, the processor-based types `uint64` looked very strict, optimized the code for hardware architecture.<p>- Having mathematically and ontological correct types is one approach `integer`&#x2F;`float`&#x2F;`string`&#x2F;`datetime`.<p>- Each type being well defined and each object-class being used as type is another strict approach.<p>Look at the types of Rust and Kotlin and see the cacophony of decisions made:<p>- Rust <a href="https:&#x2F;&#x2F;doc.rust-lang.org&#x2F;reference&#x2F;types.html" rel="nofollow">https:&#x2F;&#x2F;doc.rust-lang.org&#x2F;reference&#x2F;types.html</a><p>- Kotlin <a href="https:&#x2F;&#x2F;kotlinlang.org&#x2F;docs&#x2F;reference&#x2F;basic-types.html" rel="nofollow">https:&#x2F;&#x2F;kotlinlang.org&#x2F;docs&#x2F;reference&#x2F;basic-types.html</a><p>2. When you want to implement a method which applies to multiple libraries, you end up writing `fooString`, `fooInteger`, `fooDatetime` etc (or foo(String), foo(Integer)) etc. DRYing is too hard. So you end up writing 10x more methods<p>3. No you don&#x27;t avoid `null` checks at all.<p>4. Generalizations are harder to implement.<p>5. Interfaces are uglier compared to dynamic languages.<p>6. The code becomes less readable, not concise and verbose<p>7. Every new and old typed language is less elegant compared to the dynamic. Look at typescript vs javascript, typescript code is ugly, verbose, non-readable at all.