https://kotlinlang.org logo
Title
a

Andrew Gazelka

04/16/2019, 7:05 PM
We can refer to a method
foo()
of class
Bar
Bar#foo()
. Is it appropriate to reference property
baz
of
Bar
as
Bar#baz
?
also, what is this notation called? I've only learned it from others using it.
r

Ruckus

04/16/2019, 7:12 PM
I've seen that done in Java (especially in JavaDoc), but in Kotlin (from what I've seen) it's pretty much always
Bar.foo()
.
a

Andrew Gazelka

04/16/2019, 7:48 PM
hmm @Ruckus imo that makes it look like
Bar
is an object
r

Ruckus

04/16/2019, 7:52 PM
Out of context maybe, but frankly out of context both are rather meaningless.
You have the same ambiguity with just
foo()
. Is it a function call, or shorthand for
foo.invoke()
? There's no way to know out of context.
1