wchogg wrote:I'm a little bit of a type theory nerd, but I have a bit of a two tiered answer:
Does Common Lisp need a better type system? No, I really don't think it does. I don't think you could really add any kind of static typing without essentially redesigning the whole language a la Qi.
I think that it is perfectly valid, if a type system is not able to deal with all parts of a program. I'm not a big fan of the idea that you have to fit everything into "one something"... I actually would like to have several type systems at hand, and use them (even mix them) when they are appropriate for the problem. Certainly, I would have to provide annotations (or rely on runtime checks), so that they can work together, but that seems to be ok to me.
Qi is really interesting and might be one of them. AFAICT it builds on top of CL, so it does not redesign the language, but I don't know how much you can mix Qi and CL code.
In Haskell, for example, you can tell for every function whether it is purely functional or not, just by looking at its type that was inferred by the compiler.
In CL, in contrast, you can't define a type which specifies a list of integers. Well, actually you can do it using 'satisfies', but that is completly opaque for the compiler and will never be inferred for you. Another example: you can't really specifiy a string* type, which has an argument for the upper limit of the string's length.
The current CL implementations do some type inference, and check code based on that, but the result is not available in a standard way. And even if you query the result in an implementation specific way, you will get very little. Also, there is no standard way for type reflection, so you can't expand type aliases.
Even though I'm not expert, I think there are many ways to improve the current CL type system.
levy
-- there's no perfectoin