Is faking a constructor like this considered hacky...
# getting-started
c
Is faking a constructor like this considered hacky?
Copy code
fun Foo(stringValue: String): Foo {
  // .. do work and return foo
}

class Foo(val first: Int, val second: Int) {
    init {
        if (first !in 1..10) {
            throw IllegalArgumentException("first must be between 1 and 10")
        }
        if (second !in 22..33) {
            throw IllegalArgumentException("second must be between 22 and 33")
        }
    }
}