Data class get all components/properties

what will the type of components.all be?

list of all properties you can use in a loop

will the list of be of type List<Any?>?

And how does the map not meet these requirements?

Returning the map of properties of a data class could be nice to use if implemented internally in Kotlin.

Again, what will the type of the map be?
The best you can do is Map<String, Any?>, which isn’t very usable since you are consuming the properties as Any?, which has already been mentioned several times in the previous comments you have ignored

You can use Any as well as the specific type. Just add something like:

when (value) {
  is String -> foo()
  is Number -> bar()
  is MyInterface -> next()
}

At the moment this looks like the most optimal solution. Sadly, it’s still verbose especially after you added setters. And instead of fun forEach you can return values directly for using default methods.

Actually not, because this forEach provides immutable vals. And I can do the whole class shorter with this method:

fun each(action: (Int) -> Unit) {
    with(action) { foo; bar }
}

At least, the array can be used directly.