|
|
|
|
|
by lispm
2809 days ago
|
|
No. A type inference does not check types. It inferences types. For example if you know that + is defined for numbers, then you can inference that a and b must be numbers: (+ a b) If you know that a and b are numbers then you can inference that subexpressions need to deal with numbers only: (let ((a c) (b d)) (declare (type number a b)) ....)
The type inferencer then will tell what types the various expressions have. It will try to propagate known types as widely as possible in the code.Allegro CL and LispWorks for example are doing this type inference. But their compiler will not tell you that type declarations are violated. SBCL OTOH treats type declarations as type assertions which can be checked at compile time. ADDITIONALLY it also does type inference - and additionally uses this information for compile time type checks. |
|
OK, on that definition, of what possible use is a type inferencer? Aren't they useful only as a component of a compile-time type checker?