Better, but still not really a fan, I think.
I’m not super fluent in JS, but I’m fairly sure that for a public property, you can say
object.property = value
If that property becomes private and you create a set method instead, you have two choices on how to do things:
Either
object.property = value
no longer works, in which case we’re back where we startedOr it does still work, in which case it looks to the API user like they’re modifying the property directly, which can lead to confusion if the actual fact of the situation is that they’re touching a piece of logic that just, incidentally, also sets the property but can do other things as well.
I’m sure there’s a use case, the designers probably aren’t fools, but I don’t like it.
Is this still about Kotlin? Kotlin is a language that now also compiles to JS, but otherwise has nothing to do with it.
Still about Kotlin, a language I don’t know but whose homepage immediately made me think “JS framework” when I opened it.