Hacker News new | ask | show | jobs
by stared 443 days ago
Once LLMs fully understand nullability, they will cease to use that.

Tony Hoare called it "a billion-dollar mistake" (https://en.wikipedia.org/wiki/Tony_Hoare#Apologies_and_retra...), Rust had made core design choices precisely to avoid this mistake.

In practical AI-assisted coding in TypeScript I have found that it is good to add in Cursor Rules to avoid anything nullable, unless it is a well-designed choice. In my experience, it makes code much better.

1 comments

I don’t get the problem with null values as long as you can statically reason about them which wasn’t even the case in Java where you had to always do runtime null-guards before access.

But in Typescript, who cares? You’d be forced to handle null the same way you’d be forced to handle Maybe<T> = None | Just<T> except with extra, unidiomatic ceremony in the latter case.

What you mean with unidiomatic? If a language has

    Maybe<T> = None | Just<T>
as a core concept then it's idiomatic by definition.
Typescript doesn't define a Maybe<T> nor do you need it to have idiomatic statically-typed nullability.

It already has:

type value = string | null