As well as declaring variables with these types, you can also call them
just like ordinary functions, in order to test if a value is a certain
type.
atom
|
- |
test if an object is an atom |
integer
|
- |
test if an object is an integer |
sequence
|
- |
test if an object is a sequence |
string
|
- |
test if an object is a string |
object
|
- |
test if an object is an object (true except when unassigned) |
Technicalia
|
- |
In some cases the compiler issues 'probable logic error' warnings, which can be very helpful,
for suspicious tests such as integer(i) , when it knows the result with absolute
certainty, since that suggests that you are either testing the wrong thing or testing it twice.
Likewise for the other builtin types atom/string/sequence, however the compiler never issues
any warnings about object() tests, and is simply not smart enough to do anything similar with
user defined type tests.
|