AI Coding Has Erased the Supposed Advantage of Statically Typed Languages - yyhh.org
Toggle navigation
yyhh.org
About
Experience
Notebook
Opinion
For years, advocates of statically typed languages have made the same argument:<br>types catch mistakes earlier, compilers provide better feedback, IDEs offer<br>better assistance, and large codebases become safer to maintain.
That argument rests on an assumption that is rapidly becoming outdated: The<br>person writing the code is human.
AI is not human. It does not prefer Python because Python feels simple. It does<br>not admire Rust because Rust feels rigorous. It has no taste, no emotional<br>attachment, and no programming-language identity.
To an AI, languages differ primarily in how much code, and therefore how many<br>tokens, it must generate to express the same idea.
The more complicated the language, the more tokens it requires. The more tokens<br>it requires, the more opportunities the model has to make a mistake.
It really is that simple.
AI Does Not Need a Type System to Catch Errors
Compiler feedback matters when humans write code.
People forget function signatures. They confuse return types, overlook null<br>values, miss fields, and call methods that do not exist. A type checker acts as<br>a guardrail, catching these mistakes before the program runs.
It is therefore tempting to apply the same logic to AI:
Statically typed languages give AI more feedback, so AI produces better code<br>in them.
This is mostly cargo-cult reasoning inherited from human programming.
When was the last time you saw a capable coding model remain stuck on an<br>ordinary compilation error?
A missing parenthesis, an incorrect primitive type, or a nonexistent method is<br>no longer the central problem in AI-generated software. Such errors<br>occasionally happen, but the model reads the compiler message and fixes them<br>almost immediately.
AI's expensive mistakes are not usually compilation errors. They are<br>misunderstandings.
The model implements the wrong business rule. It overlooks an edge case. It<br>misinterprets the meaning of the data. It breaks an unstated concurrency<br>assumption. It produces a system that is perfectly type-correct and logically<br>wrong. A type checker cannot save you from that.
The claim that AI needs "more compiler feedback" sounds technical, but it often<br>amounts to repeating an old argument without looking at the reality: AI almost<br>always one-shot the code, and compiler feedbacks are not involved for the most<br>part.
Types Are Cost Too
Types are usually described as protection. They are rarely counted as cost.
For AI-generated code, however, a type declaration is first and foremost<br>additional information that must be generated, maintained, and kept consistent.
Types are valuable when they encode real domain constraints:
An order total cannot be negative.
A cancelled transaction cannot be settled again.
An unauthenticated user cannot perform an administrative operation.
But much type information does not express constraints like these. It merely<br>repeats facts that are already obvious from the implementation:
This argument is a string.
This function returns a list of users.
This value might be absent.
This structure implements this interface.
In the human-programming era, this repetition helped programmers understand<br>unfamiliar code. It also allowed IDEs and compilers to catch simple mistakes.
But an AI model is already an extraordinarily capable pattern recognizer. It<br>can often infer these relationships from names, implementations, call sites,<br>tests, and surrounding context.
Requiring the model to state everything again does not automatically improve<br>correctness. It increases output length and adds another consistency<br>obligation.
If a constraint cannot eliminate a meaningful business error but requires<br>dozens of additional tokens, it may be providing ceremony rather than safety.
Compilation Is No Longer the Scarce Capability
The most commonly advertised benefit of static typing is that it moves errors<br>into the compilation stage. In AI-assisted development, compilation errors are<br>among the cheapest errors possible.
The expensive errors are the ones the compiler cannot see:
The requirement was misunderstood.
The tests encode the wrong assumption.
The data model does not reflect the real business.
The API appears reasonable but breaks compatibility.
The concurrent code type-checks but contains a race condition.
The authorization logic compiles but permits unauthorized access.
A program compiling successfully proves only that it satisfies the small subset<br>of rules represented by its type system. Nowadays, this does not buy much,<br>because any frontier AI can almost always meet this narrow requirement in a<br>single shot.
Since AI-generated code already spends very little time stuck on basic compilation<br>failures, continuing to present compiler feedback as a decisive advantage is<br>like advertising a self-driving car on the strength of its gear-change<br>indicator. It...