y
02/25/2024, 1:26 PMenum class Bar {
ONE,
TWO,
}
and
enum class Foo {
A,
B,
C,
;
val asBar get() =
when (this) {
A, B -> Bar.ONE,
C -> Bar.TWO,
}
}
vs.
enum class Foo(val asBar: Bar) {
A(Bar.ONE),
B(Bar.ONE),
C(Bar.TWO),
}
the second one compiles to something shorter, so is it the preferred way to write this?
specifically, is it also "zero sized" (whatever that term would mean in JVM land)?jamshedalamqaderi
02/25/2024, 1:29 PMJoffrey
02/25/2024, 1:51 PMasBar
might need to be revisited based on the real domain names, as this is usually a function name.ephemient
02/25/2024, 3:06 PMephemient
02/25/2024, 3:07 PM