Dammit just came across another use case for this:...
# language-proposals
k
Dammit just came across another use case for this:
Copy code
class Matrix {
    ...
    operator fun get(r: Int, c: Int) = ...
    
    inner object Transpose {
        operator fun get(r: Int, c: Int) = this@Matrix.get(c, r)
    }
}
1
k
Isn’t this already possible today via:
Copy code
class Matrix {
    ...
    operator fun get(r: Int, c: Int) = ...
    
    val Transpose = object {
        operator fun get(r: Int, c: Int) = this@Matrix.get(c, r)
    }
}
? 🤔
k
No, users outside of
Matrix
can't see any functions or properties in
Transpose
k
Ah. You’re right. I forgot about that 👍