-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat!: change unit enums to objects #62
base: trunk
Are you sure you want to change the base?
feat!: change unit enums to objects #62
Conversation
public val Decimilliare: AreaUnit = object : AreaUnit { | ||
override val symbol: String = "dma" | ||
override val millimetersSquaredScale: Long = 100 | ||
} | ||
public val Centiare: AreaUnit = object : AreaUnit { | ||
override val symbol: String = "ca" | ||
override val millimetersSquaredScale: Long = 1_000_000 | ||
} | ||
public val Deciare: AreaUnit = object : AreaUnit { | ||
override val symbol: String = "da" | ||
override val millimetersSquaredScale: Long = 10_000_000 | ||
} | ||
public val Are: AreaUnit = object : AreaUnit { | ||
override val symbol: String = "a" | ||
override val millimetersSquaredScale: Long = 100_000_000 | ||
} | ||
public val Decare: AreaUnit = object : AreaUnit { | ||
override val symbol: String = "daa" | ||
override val millimetersSquaredScale: Long = 1_000_000_000 | ||
} | ||
public val Hectare: AreaUnit = object : AreaUnit { | ||
override val symbol: String = "ha" | ||
override val millimetersSquaredScale: Long = 10_000_000_000 | ||
} | ||
public val entries: List<AreaUnit> = listOf(Decimilliare, Centiare, Deciare, Are, Decare, Hectare) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it might make sense to make all of these getters? Eg.
private val Decimilliare: AreaUnit get() = object : AreaUnit { ... }
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure. I generally don't like that pattern because the objects lose their name and and become anonymous objects.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, on second thought -- I think we should pause this until #42 is complete. Each of these being anonymous objects is pretty awkward and this will likely significantly change once the work in the above issue is completed.
prerequisite for #58