Can this be considered a Kotlin Vulnerability that...
# announcements
a
Can this be considered a Kotlin Vulnerability that if a
var name=<lambda>
is declared in a class, its returning value can be modified for a particular instance?This instance can be passed on to other functions which would end up with wrong data. I thought kotlin lambdas are supposed to be a clean looking replacement for functions, but functions do not change their logics. For eg:
d
There are many ways of writing bad code. Using coding principles like Always use val unless you explicitly intend to modify it later, goes a long way to avoid it
d
Nothing special in my opinion. You can just as well make the name public var and change it from the outside. For the lambda the same, you are not changing the lambda, you provide a different one
d
Intellij by default has an inspection suggesting not to use
var
unless you're actually using its functionality