wiki:BigIdeas/StaticTyping

Static Typing

Programming is a process of translating ideas into code, or so we have been told by B.S. Understanding of [even your own] code becomes a huge problem once a code base has been grown, and many people are involved.

Figuring out (or even mere guessing) valid arguments or return value types of a function (could I return NULL or -1) becomes a headache.

To use correctly a dynamically-typed code you have to read it, which takes lots of time and results in frustration, lose of motivation (most of the code is fucking crap) and burnout.

With proper (sound) static typing it could be proved (rigorously verified) that there is no inconsistencies between how abstractions are declared and actually used. This is the point. You don't have to read the fucking code.

A good static type system (as in Haskell or Scala or even Ocaml saves tons of effort in a large project.

Boy, even C++ is a huge improvement against plain C, whose type system is completely unsound (for the most part of C++ types are sound, except C-compatibility stuff, of course).

Pattern-matching

Good languages allow you to pattern-match on Algebraic Data Types so your code will be more safe (handling of all the special cases (NULLs or Nones) will be ensured (guaranteed) at compile time). Non-exhaustive matching will be warned. This is big.

Just use good languages.


see also Languages/ProtoVsImpl, BigIdeas/TypeAnnotations

Last modified 5 months ago Last modified on Sep 23, 2019, 2:22:04 PM
Note: See TracWiki for help on using the wiki.