Thank you rephrasing. Just to confirm:
People are concerned here about a different thing. That you want to use these features to write compile-time tests of your own code. So this is like first defining
foo
asInt
and then checking thatfoo
isInt
. It basically doubles the code without any direct benefits.
I never intended to use compile-time tests unless we start calling type safety in Any
vs Int
example “compile-time tests”.
Note that in this
@OnlyInputTypes
issue linked by you, people didn’t want to use this feature in the way how you do. They need it to create an API and restrict how it could be used by others. Stdlib uses these annotations for similar reasons. On the other hand, you try to test your own code. But maybe I misunderstood you.
This is exactly my use case, to restrict how the API is used. With @Exact
and @OnlyInputTypes
I can introduce such restrictions so that only meaningful combinations of types can be used. It’s really no different that my Any
vs Int
example – I just control which inputs are meaningful.