Better HN
topnewbestaskshowjobs
Log inSign up

jflwyasdf

2 karma · joined Apr 25, 2024 (2y ago) · 6 submissions

Submissions

comment 2y ago · link · parent

Right that depends if you subscribe to the belief that null means the absence of a value `Option<T>` or does it mean the zero value `T`.

comment 2y ago · link · parent

This is how I would do it.

  Go: *string

  Java: Option<String> or @Nullable String

  Rust: Option<String>

  TypeScript: string | undefined (or string | null)

comment 2y ago · link · parent

null would just mean the zero value instead of the absence of a value

  String foo = null;

  String bar = "";

  foo.equals(bar) --> true
This works well provided the data type has a sensible zero value like collection types

EDIT: I'm blocked from posting so I won't be responding further, thank you for discussion.

comment 2y ago · link · parent

Fortunately, Uber made tooling for languages with broken type systems

* https://github.com/uber/NullAway

* https://github.com/uber-go/nilaway

comment 2y ago · link · parent

Former ActiveRecord & Django ORM enjoyer here.

I've been using sqlc, sqlx, pgtyped, & kysely and I found they have ORM-like productivity with full type-safety but they don't bring the baggage of leaky abstractions.

Unfortunately I don't know if there are Ruby or Python equivalents yet.

comment 2y ago · link · parent

Their username says it all: https://landscape.cncf.io/