Slacker News Slacker News logo featuring a lazy sloth with a folded newspaper hat
  • top
  • new
  • show
  • ask
  • jobs
Library

Want Discriminated Unions in Kotlin? Use a Sealed Class

2 days ago (spin.atomicobject.com)

1 comment

ingve

Reply

FrankWilhoit  2 days ago

Discriminated unions are a terrible way to enforce type safety. They are a backport of a physical-data-modelling antipattern. Inheritance or GTFO.

Slacker News

Product

  • API Reference
  • Hacker News RSS
  • Source on GitHub

Community

  • Support Ukraine
  • Equal Justice Initiative
  • GiveWell Charities