3 ms·
sure, go ahead. The type information is there.
by lispm 8y ago
sure, go ahead. The type information is there.
- marcosdumay 8y agoIndeed. I had convinced myself I was reading Clisp, instead of CLOS.
- lispm 8y agoCLOS is a part of Common Lisp. Fully integrated.
- marcosdumay 8y agoThose type annotations are on clisp? I probably should get a project to test them :)
- lispm 8y agoCLISP is an implementation of Common Lisp. The language is called Common Lisp. Common Lisp has an object system with classes since the early 90s. In fact it was the first standardized object-oriented language. Common Lisp also has optional type declarations. Not very sophisticated, but they are there. Check out the SBCL implementation, which has a compiler which does some static type checking/inferencing. http://www.sbcl.org http://www.sbcl.org But one usually can use types/classes at runtime, too.
- marcosdumay 8y agoBookmarked for my next project. Thanks.
- bsaul 8y agoDidn't know about those type annotations in lisp, but i suppose what you mean is that an ide could parse all the code, infer the type of all the function / variables etc (just like the lisp interpreter would) and provide you with refactoring facilities ? That's a good thing. But then comes the git merge (or any other automatic code altering tool). How do you know something hasn't been messed up in the process ? (unless you wrote unit test for every argument of every function)
- lispm 8y ago> lisp interpreter Lisp has compilers. Some do also some type checking, here SBCL 1.5.2: (declaim (ftype (function (fixnum) fixnum) foo)) (defun foo (a) (+ a 1)) (declaim (ftype (function (fixnum) string) bar)) (defun bar (a) (if (zerop a) "zero" "not-zero")) (defun baz (a) (foo (bar a))) Then: * (compile-file "/tmp/test.lisp") ; in: DEFUN BAZ ; (FOO (BAR A)) ; ; note: deleting unreachable code ; ; caught WARNING: ; Derived type of (BAR A) is ; (VALUES STRING &REST T), ; conflicting with its asserted type ; FIXNUM.