Empty Sentinel Instance

Give a model a canonical empty instance on its companion object so its holders can declare the field non-null, instead of threading a nullable through every layer. Covers when this genuinely removes a whole family of null checks and when it only adds a second check beside the one already there, the emptiness predicate that has to ship with it, keeping the sentinel out of persistence and out of rendered lists, and where a nullable is the honest signal. Use when call sites test both for null and for the sentinel, when an empty-keyed row appears in storage, or when a list renders one blank entry at startup.

maxrave-dev 2961047 7.1 KB Updated

File contents

maxrave-dev/kotlin-footguns/tree/main/skills/empty-sentinel-instance commit 29610470d5

Frequently asked questions

npx skillmds@latest add maxrave-dev/empty-sentinel-instance