Hasty Briefsbeta

Omittable – Solving the Ambiguity of Null

3 days ago
  • #Java
  • #Null Handling
  • #REST API
  • REST API partial updates and filtering in statically typed languages like Java can be challenging due to the conflation of null and absence.
  • Java's null is technically just a value but is often misused to denote absence, leading to semantic ambiguities.
  • Optional in Java was introduced to handle 'no result' scenarios but doesn't distinguish between null and absence.
  • Type annotations like @Nullable and @NonNull provide better nullability handling but still don't solve the absence vs. null problem.
  • Omittable is a library that introduces a monad to distinguish between absence and null, providing a clearer semantic distinction.
  • Java's future may include null-restricted and nullable types to better handle these issues at the language level.