News for hackers. Stuff that matters.
Re:Kotlin Money by Tainnor on Thursday October 10, 2024 @03:07PM (#41802277)
> except throwing OOP into something that doesn't need it

I feel like you're jumping to wild conclusions. All I'm suggesting is to change your code to

  private object EUR : Currency
  private object USD : Currency

  data class Money<C : Currency>(...) { ... }
That's just an empty tag interface and that's not particularly hardcore OOP, you can do the same thing with Haskell typeclasses.

There are no comments on this comment yet.