4 ms·
It goes both ways. Lisp has certain attributes that also make modern programmers go "Yeah, back then it sounded like a good idea". Being dynamically typed come
by incepted 10y ago
It goes both ways. Lisp has certain attributes that also make modern programmers go "Yeah, back then it sounded like a good idea".
Being dynamically typed comes to mind.
- wtbob 10y agoLisp is both dynamically and statically typed: (defun foo (x y) (declare (type (integer 1 12) x) (type character y)) (make-string x :initial-element y)) And the compiler will provide a compile-time error if someone tries to call (foo 1 2) but will accept (foo 1 #\a). Even cooler, it will provide a compile-time if the developer tries to call foo with a first argument which is not provably an integer from 1 to 12. In fact, you might even say that it's statically typed since values which have undeclared types are really of type T, but I don't think I'd go that far.
- incepted 10y agoSure, Lisp has many derivatives, some of which are statically typed. The most popular Lisp today, Clojure, is dynamically typed, though.
- wtbob 10y agoCommon Lisp not a Lisp derivative: it is Lisp. Someday, of course, there may be a successor language, but Clojure is not. Clojure is a Lisp-like language with — I'm told — many good and/or interesting idea. I don't know if it's actually the most popular Lisp-like language (I'd think Scheme would be), but it probably is more popular than Lisp. That's sad, but that's life.
- TeMPOraL 10y agoClojure is a kind of Javified Lisp; if you're looking for a canonical example, the GP provided an example of Common Lisp code, which gives you optional type declarations that are compile-time checked and are used by compilers to generate more optimized code.