4 ms·
Lisp's optional type declarations don't provide any compile-time guarantees though, they're just hints. (Although some implementations do use them to make compi
by foldr 13y ago
Lisp's optional type declarations don't provide any compile-time guarantees though, they're just hints. (Although some implementations do use them to make compile-time checks.)
- wes-exp 13y agoDepends what you are going for. If the point of type declarations is speed, I think most high-quality CL implementations will take advantage of a type declaration. If the point is compile-time type safety, yeah, that's a more obscure feature. Of course you can always use check-type for run-time type safety though.
- foldr 13y agoWell, in the context of refactoring, it's presumably compile-time safety that's relevant.
- ohyes 13y agoTechnically, your are correct. HOWEVER, In most of the compiled versions you set speed/space/safety/debug levels 1-3 and get different uses of the type hints. In SBCL, if i set safety/debug at high priority, I will get warnings or errors if I make a type mistake. Furthermore, there is an option you can turn on to make the type infrencer tell you what it is doing. Here's some example doc: http://common-lisp.net/project/cmucl/doc/cmu-user/compiler-hint.html#toc136 http://common-lisp.net/project/cmucl/doc/cmu-user/compiler-h... You'll notice that CMUCL's compiler is called 'Python' so technically, Python supports type inference. :)