Andrew Gazelka
11/21/2018, 3:31 PMisEmpty be a function? Also wouldn't the value stored in isEmpty never be referenced?orangy
Andrew Gazelka
11/21/2018, 3:38 PMsindrenm
11/21/2018, 3:38 PMval, and I know that the type that the val is referencing is deeply immutable (like a Boolean), I want to believe that what I receive from accessing the property is the same every time. Of course, with the case of custom getters like this, it's not necessarily the same every time, like if this is a property defined in a mutable list. Essentially, what I'm wondering if it's “OK” to write code like this, where the deeply immutable “contents” of a val can change from each invocation of the getter.Andrew Gazelka
11/21/2018, 3:39 PMAndrew Gazelka
11/21/2018, 3:39 PMvalAndrew Gazelka
11/21/2018, 3:40 PMsindrenm
11/21/2018, 3:40 PMAndrew Gazelka
11/21/2018, 3:40 PMvar (imo)sindrenm
11/21/2018, 3:41 PMisEmpty(): Boolean instead, perhaps?Andrew Gazelka
11/21/2018, 3:41 PMAndrew Gazelka
11/21/2018, 3:41 PMAndrew Gazelka
11/21/2018, 3:41 PMsindrenm
11/21/2018, 3:43 PMval does not by any means suggest that the thing referenced is immutable, but that's another topic. One could, for instance, have a val names: MutableList<String>.