Why do delegate class methods `getValue` and `setV...
# getting-started
a
Why do delegate class methods
getValue
and
setValue
need to marked with
operator
keyword?
h
to be accessed like:
Copy code
val message: String by delegate
a
I thought so! But I don’t see anywhere in the doc that
by
is an operator, just a soft keyword
h
yeah 🤔 actually
by
can be used on simple classes too https://kotlinlang.org/docs/delegation.html
a
Yeah your link mentions
by
as clause not an operator, right?
👍 1
h
image.png
and in observable delegate, setValue and getValue are not operators
so, idk 😄
👍 1
a
Actually
ReadWriteProperty
which
ObservableProperty
inherits from defines them as `operator`s 🙂
h
yeah, that's true blob thinking upside down
a
I’ve created a StackOverflow question just in case.
@henrikhorbovyi someone answered the question perfectly on SO. You might want to check it out.
h
ooh... cool
a
by is an operator. It operates on getValue and setValue. If the docs is missing that, then its something that has to be added