3 ms·
Yes. With macros and runtime logic it's possible to implement just about any type system in Lisp, even an ML-like system. Box everything and use macros to tra
by retrac 4y ago
Yes. With macros and runtime logic it's possible to implement just about any type system in Lisp, even an ML-like system. Box everything and use macros to transparently pick it apart and reconstruct your wrapped type objects when you use them. My initial reaction to that whole idea was horror. The inefficiency! But maybe not necessarily. A compiler that understood the type system used, could optimize most of it away. Just like how Haskell or SML compilers do.
- kazinator 4y agoIt exists. Qi, Coalton.
- slaymaker1907 4y agoTyped Racket is an example of a typed language built off of a dynamic base that still manages to use type information for optimization. The main way it does that is by using existing unsafe APIs from the dynamic language, but in a safe way with the type information.