[main page]

Benefits of dynamic typing, part 5

25 October, 2026 / color theme: ef-spring

Problems with types

Types enable type astronautics

Imagine a generic parameter inside a generic parameter inside a generic parameter inside a generic parameter inside a generic parameter in TypeScript.

Or a two-screen compilation error from the Zod library.

Or code that takes ages to compile because it generates types dynamically based on some conditions.

Types are not essential to programming

According to Wikipedia:

Computer programming is the composition of sequences of instructions, called programs, that computers can follow to perform tasks.

It involves designing and implementing algorithms, step-by-step specifications of procedures, by writing code in one or more programming languages.

Types are the thing we use to forecast our program’s behavior and to exclude certain types of errors. That’s not essential to programming, because at the end of the day, programming is about producing artifacts and systems, and making the computer do cool stuff.

It means that types are a tool, and a tool is useful in some situations and not as useful in others.

That’s why languages that let us introduce types gradually (like Python and Elixir) are very cool, but types should not be the default; they should be opt-in, in my opinion.

Benefits of schemas

Types are a DSL (also reflection, and tags in Go)

Creating types, manipulating them at runtime via reflection and specifying additional properties and metadata on types (like using tags in Go). These things have a separate syntax that needs to be learned, and it’s not possible to introduce conditions via plain ifs of the language. For example, creating types in TypeScript that depend on a condition looks pretty ugly.

Can be generated dynamically

A consequence of the previous point: schemas can be generated dynamically using plain old language constructs.

Better tests

Such schemas often support generating test fixtures, which helps with property-based testing.

Errors can be specified

Static types should not only check for errors, but also explain what went wrong. In schemas, it’s a common feature to be able to specify a custom error message, which is not ideal (with the error message usually comes a stack trace), but at least it’s some help.

Conclusion

Overall, I like how Clojure programs interact with the outer world. They are more open, adapts faster, give faster feedback when we need it, and have an admin dashboard on steroids from the ground up.

I like a talk about Clojure in live sport television, which shows how fast we need to adapt sometimes, and how Clojure values help with that a lot.

Prev