We can refer to a method `foo()` of class `Bar` `B...
# announcements
a
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
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
hmm @Ruckus imo that makes it look like
Bar
is an object
r
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