←back to thread

169 points mattmarcus | 2 comments | | HN request time: 0s | source
Show context
stared ◴[] No.43613565[source]
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.

replies(1): >>43613926 #
hombre_fatal ◴[] No.43613926[source]
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.

replies(1): >>43615878 #
1. ngruhn ◴[] No.43615878[source]
What you mean with unidiomatic? If a language has

    Maybe<T> = None | Just<T>
as a core concept then it's idiomatic by definition.
replies(1): >>43622292 #
2. hombre_fatal ◴[] No.43622292[source]
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