[ prog / sol / mona ]

prog


Static Typing

1 2021-11-11 14:51

What are your thoughts surrounding static and dynamic typing?

There's a new development[0] within Common Lisp that aims to support static type checking.

My experiences with static type checking have been annoying at best.
Here are some supplemental statements[1], which I hope will serve as a springboard for further discussion.

~Static Typing~

Advantages:
- More errors are caught
- One can refactor with greater confidence
- Can ease the mental burden of writing programs
- Types serve as documentation

Disadvantages:
- Time investment
- The actual error report is vague at best
- Suffocating
- Boilerplate
- Difficult & choice fatigue

[0]: https://github.com/coalton-lang/coalton
[1]: https://pchiusano.github.io/2016-09-15/static-vs-dynamic.html

2 2021-11-11 19:49

As you say there is pros and cons. I am not adverse to static typing but it depends on the circumstances. For a short/mid-length script it's pretty much overkill. For larger projects i prefer the clarity of static types as it not only enables the compiler to catch stupid errors but also reminds you of what kind of data your dealing with. Obviously you can also have static types that are mostly meaningless (like passing around pointers to char/uint8_t representing binary blobs of some magical size - don't do it's impossible to define a meaningful type...) but if care is taken the result is quite helpful when reading the resulting code.

20


VIP:

do not edit these