Feature Request: Number Reference


Is it possible to return a reference to a number (Int, Long…) in Kotlin? For example, I have a variable a: Int = 5 and a function identity(a: Int) = return a, I want to do something like identity(a) += 5 which will add 5 to a.

If it is not possible, I think it would be very nice if Kotlin can support it one day.

Thank you for creating Kotlin

JVM has atomic numbers like AtomicInteger. Which are mutable and used by reference. You can overload ariphmetics for them.