Has it been proposed to introduce a constructor th...
# language-proposals
b
Has it been proposed to introduce a constructor that might return
null
? I can’t find it on YT: https://youtrack.jetbrains.com/issues?q=project:%20Kotlin%20optional%20constructor%20type:feature%20(state:Open%20OR%20state:Submitted%20OR%20state:Investigating%20%20OR%20state:InProgress%20OR%20state:%7BWaiting%20for%20Info%7D%20OR%20state:%7BWait%20for%20Reply%7D%20OR%20state:%7BIn%20Progress%7D) I imagine syntax like Swift, where a
?
after the keyword denotes that the constructor might result in a
null
object:
Copy code
class Foo(val bar: Bar) {
    constructor?(barString: String): this(bar = Bar.fromStringOrNull(barString))
}