Hello, World! Isn't there a shorter way to do thi...
# announcements
b
Hello, World! Isn't there a shorter way to do this (with
by
)?
Copy code
var parameter: Parameter
        set(value) {
            delegate.parameter = value
        }
        get() = delegate.parameter
m
the property for being writeable or readable is not within the type itself. therefore you'll have to use either a wrapper in a delegate, or do it like you did.
j
yeah something like:
var parameter by delegate
but then you'd have to create the delegate as well, maybe this will inspire you
b
yeah but basically I wanted to delegate only this particular field 🙂 In my case
delegate
is actually already an interface which I don't want to implement fully
r
If this will only be done this one time, what you have is probably best. No point creating custom delegation behavior for a single use.
Well, almost best. Having
set
before
get
looks really weird to me, but that's neither here nor there.
b
😄 true, don't know why I did that
thanks everybody anyway!