Hacker News new | ask | show | jobs
by kaba0 1045 days ago
It sounds like badly documented code then. A function, especially if some kind of API boundary, should absolutely state whether it can or can’t return null.

Ideally everything should be non-nullable, with optionally specified nullability.

1 comments

> It sounds like badly documented code then. A function, especially if some kind of API boundary, should absolutely state whether it can or can’t return null.

Of course, in the type system.

Just like we're "documenting" types themselves in the type system and not in JavaDocs.