I don’t really follow you here <@U0BGSQ7E0> , you ...
# announcements
m
I don’t really follow you here @andrewoma , you say:
But really it doesn't make sense when combined with hard constraints. If you want a hard constraint, you wouldn't default it.
To me contraints and default values are two separate concerns. The only optimisation I can think of is that you want to skip constraint validation when you use a default value which you control. On which you can use null as a default indicator, e.g.:
Copy code
class Bar

data class Foo(bar: Bar? = null) {
    public val bar: Bar
    
    init {
       //validate `bar`
       this.bar = bar ?: Bar()    
    }
}