3 ms·
> As for LISP, TypeScript services as a good test case for layering dynamic languages with type systems, so why not TypeLISP? Lisp users think that a 'dynamica
by lispm 7y ago
> As for LISP, TypeScript services as a good test case for layering dynamic languages with type systems, so why not TypeLISP?
Lisp users think that a 'dynamical' and a 'dynamically typed' language are two different things. Lisp is both. Being 'dynamically typed' supports or simplifies a lot of dynamical features.
There are a bunch of languages which implement a subset of Lisp features and which were adding type systems. Historically much of typed FP was developed out of Lisp tradition.
Common Lisp for example has CLOS definitions like:
(defclass person (living-thing)
((name :type string)))
So the definition makes clear that are a class/type which inherits from the class/type living-thing. It also defines that contents of the slot name are of type string.
A CLOS method then is:
(defmethod say ((from person) (to person) (m message))
...)
Which means that an object of class person sends to another object of class person an object of class message.
Multi-methods in CLOS allow us to define and dispatch on the class of several arguments.
Common Lisp then also has type declarations:
(defun collide (a b)
(declare (type moving-object a b))
...
)
This allows programs to document types, compilers to use types for optimization purposes and some compilers to do type checking.
What Common Lisp lacks is a more extensive/expressive type system which would be competitive with what Haskell/or similar would offer.