Mutable Function Parameters


#1

Hey everyone,

I was just thinking why can’t we optionally (and without any modifiers they are val) have mutable function parameters like:

fun (var convertView: View?) {
    if (convertView == null) convertView = View(activity)
    // do something with convertView
}

#2

This was discussed here: Function parameters are “val” not “var”?
The rationale for this behavior is explained here in “Parameters are Immutable” section: https://blog.jetbrains.com/kotlin/2013/02/kotlin-m5-1/