3 years ago
    I would like to get some feedback concerning variable length argument lists. I am using the following pattern throughout the API for variable length argument lists:
    first: T, vararg others: T
    . For instance:
    fun <E : Any, T : Iterable<E>> Assert<T>.contains(expected: E, vararg otherExpected: E)
    The intention behind it: this way one has to pass at least one argument (compiler is not happy otherwise). I would like to know what you experienced so far:1️⃣ it was helpful2️⃣ it is confusing/makes things more complicated


    3 years ago
    I prefer this because it means I can’t accidentally give no parameters at all, which is almost certainly a mistake