27th February 04:39
(Sorry, not at run-time, only at compile-time.)
SML is not a dynamically typed languages (i.e. types checked at run-time).
It is a statically typed language (types checked at compile-time).
(Do not confuse this with the fact that SML uses type inference/
reconstruction (i.e. that one *doesn't* have to declare the types of
arguments, results and variables).
The usual alternative to this is manifest typing (i.e. one *have* to
declare types of arguments, results and variables). (E.g. C does this.))
(There are often confusion here, different people using different
terminology :-( )
So sorry, what you ask for is not possible, because SML is (exclusively)
(Perhaps you now think : "Java is statically typed, but Java has
'instanceof'" ? Well, 'instanceof' is a way for dynamic typing to
"creep" back into a language that (also) has static typing ;-) Not all
languages that is said to be OO has a facility of this kind ('type-case'
as it is usually called).)
Perhaps you could tell us what you are trying to do, and why you thought a
type-case might be appropriate ? Then perhaps we could explain how to do
what you want (if possible) ?
(E.g. 'datatype' might be a solution to what you are trying to solve.
Hard to tell without more info on what you are trying to do.)
(As always, if I say something stupid, correct me.)
The infinity that can be finitely expressed is not the true infinity