how do you make a property reference with that?
# announcements
j
how do you make a property reference with that?
👆 2
s
okay this is starting to sound familiar (although Im not sure I understood the answer in the early days)... can you elaborate
j
is
foo.bar
a bound reference to the property
Foo.bar
on instance
foo
or an invocation of the getter of the
bar
property on the
foo
instance? The syntax is ambiguous.
g
Copy code
class Foo {
    val bar: String = ""
    fun bar() = ""
}

Foo().bar // ???
Of course in theory it was possible to restrict such naming, but it would bring a lot of problems with JVM interop
s
great thanks. that makes sense and that answers that question! cheers guys
next, why isn't this caught at compile time?
g
caught at compile time?
s
ah nevermind
::fn will fallback to use the property if there is no fun fn
g
Yes, reference to properties are also supported
but resolution may be ambiguous
s
thanks, til ☝️ everything above 🙂
g
For example you can do even this (but only if you don’t have ambiguous naming, like in my first sample): https://pl.kotl.in/ryapLxLPN
👍 1