Hacker News new | past | comments | ask | show | jobs | submit login

This is how I would do it.

  Go: *string

  Java: Option<String> or @Nullable String

  Rust: Option<String>

  TypeScript: string | undefined (or string | null)



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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: