Sorry, I made that sound backwards. It will only grab a field if that field is public. So, you can start out with direct field accessors, but then change to a getter without having to change any of the calling code.

nuclearspaceheater:

shieldfoss:

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 started

Or 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.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s