Why is Korma's Easing interface not an enum?

  • Question for @soywiz: why are all the easings in Easing.kt in a hidden object and not in an enum?

    Seems like

    interface Easing {
        operator fun invoke(it: Double): Double
    enum class Easings : Easing {
        LINEAR {
            override fun invoke(it: Double) = it
        // etc

    should work great, no?

    While working on https://github.com/korlibs/korma/pull/42 I thought it'd be nice to have a test case that iterated over all the easings to perform some basic assertions on them, but the current structure makes this difficult.

  • Well, the problem of enums is that are closed. What if a user wants to provide his/her own Easing?
    Maybe what we can provide is a list or a map with all the standard provided easings. That would work for you?

  • To close the loop on this, I've submitted a PR to change this in korge-next and it's been merged.

Log in to reply