I have some code that builds up SQL expressions. I created a group of sealed classes.
sealed class SqlExpr class SqlPiece(val sql: String) : SqlExpr() class SqlAnd(vararg parts: SqlExpr) : SqlExpr() ...
It would be nice to write something like:
SqlAnd("x", someExpr, "foo is null", otherExpr)
SqlAnd(SqlPiece("x"), someExpr, SqlPiece("foo is null"), otherExpr)
In some languages I could declare that
SqlExprs. In others I could declare an implicit conversion from
SqlPiece. Any recommended style for this situation in Kotlin?