<@U2H3SABQF> Sorry, but I was incorrect. This work...
# announcements
j
@elect Sorry, but I was incorrect. This works for me. The type of
cb
is indeed
Any
, but I can still access
framebufferSize
. This is in a JVM module (
apply plugin: 'kotlin'
) of a multi-platform project using Kotlin 1.2.10:
Copy code
val cb = object {
    val framebufferSize = 1
}
println(cb.framebufferSize)
e
can you access
cb.framebufferSize
in a custom setter?
j
Do you mean in
operator fun set(...)
? No, and that makes sense. You cannot access a variable in its initializer. This applies to both
cb
and
framebufferSize
a
Note that anonymous objects can be used as types only in local and private declarations. If you use an anonymous object as a return type of a public function or the type of a public property, the actual type of that function or property will be the declared supertype of the anonymous object, or Any if you didn't declare any supertype. Members added in the anonymous object will not be accessible.
😯 1