Hello,
While reading the api page for scala.compiletime, I was surprised to find constValueTuple
.
Which seems to exist as a consequence of tuples of constant types not being themselves constant types. ( for example constValue[(1,2)]
fails with not a constant type
)
As a consequence, since constValueTuple
calls constValue
on the tuple’s element, things like constValueTuple[( (1,2), (3,4) )]
fail.
And more broadly, given a type that is either a constant type or a “constant tuple”, there is no simple way to constValue
it.
There is also no equivalent to constValueOpt
for tuples.
Hence my questions:
- Why are tuples of constant types not also constant types ?
- Should
constValue
cheat, and work anyways on cases whereconstValueTuple
succeeds ? - Should
constValueOpt
cheat, and returnSome
on cases whereconstValueTuple
succeeds ? - Should
constValueTuple
use a special “union” ofconstValue
andconstValueTuple
for the elements instead ?