Writing a dsl, the getters aren't supposed to be u...
# getting-started
e
Writing a dsl, the getters aren't supposed to be used, so I'm writing this at the moment:
Copy code
var maxGCPauseMillis: Int
            get() = error("invalid")
            set(value) ..
does anyone have a better solution?
r
why a property? If you have DLS of something that is not supposed to be read, I would expect it to look it like this from the user side:
Copy code
myDsl {
    maxMillis(20)
}
1
e
because I like it more, I find it more readable
j
What is the harm in reading the value?
e
no harm, but it's not supposed to be read
seems like not really possible
especially since you cannot make the getter private
e
nice idea I found on the youtrack link reported there
Copy code
var x: Double
        @Deprecated(message = "Write only property", level = DeprecationLevel.HIDDEN)
        get() = error()
        set(value) { source.x = value }
thanks @Joost Klitsie!