Hacker News new | ask | show | jobs
by jflwyasdf 775 days ago
This is how I would do it.

  Go: *string

  Java: Option<String> or @Nullable String

  Rust: Option<String>

  TypeScript: string | undefined (or string | null)
1 comments

The problem is, not all of these languages think that "" and null are equal.
I might choose to rephrase that as "the problem is, some of these languages think that "" and null are equal." :-)
Isn't the lack of strict equality a result of loose typing in those languages?
Maybe - often more to do with overeager coercion, which does tend to go hand in hand with loose typing.