Overview of supported language constructs in `comptime(...)`
mainThe comptime(...) block allows for compile-time evaluation of Scala-like expressions. Supported constructs include:
- Literals:
Int,Long,Float,Double,Boolean,Char,Byte,Short,String,Unit, tuples, and collections. - Union Types: Supports
A | Bsyntax (e.g.,String | Boolean). - Control Flow:
if/elseexpressions,try/catch/finallyexpressions (including exception type matching and variable binding), andthrowexpressions (only for existingThrowableinstances, not constructor calls). - Variables: Blocks with local
vals andvars (mutable local variables with assignment). - Lambdas: Supported when used within standard library operations like
map,filter, orfoldLeft. - Member Access: Basic field access is supported when the receiver is a constant (e.g., case class fields).