4 ms·
You should have a look at Typed Racket [1] which is a type system for an existing language (Racket) built entirely with macros [2] that satisfies all of the cri
by samth 13y ago
You should have a look at Typed Racket [1] which is a type system for an existing language (Racket) built entirely with macros [2] that satisfies all of the criteria you want -- works with the IDE, safe interop with untyped code, etc.
[1] http://docs.racket-lang.org/ts-guide/ http://docs.racket-lang.org/ts-guide/
[2] http://www.ccs.neu.edu/racket/pubs/pldi11-thacff.pdf http://www.ccs.neu.edu/racket/pubs/pldi11-thacff.pdf
- nawitus 13y agoWow, that's impressive. I didn't realise macros can be that powerful in practise.
- innguest 13y agoMaybe this will help see the full scope of the power of macros: macros receive their arguments as an AST (i.e. a list) and are free to transform it as they please; they also have full access to the host language and are free to implement a type system checker that walks code and checks that all the types match. There are no restrictions here - the type checker would be regular scheme code that would be wrapped into a macro simply to make it run at compile time. So there's nothing less powerful about macros at all. It's just code that runs at a different stage (compile-time instead of run-time). After macros, in terms of power, you have reader macros, that receive their arguments as raw text and are free to turn it into any AST.
- klibertp 13y agoThere's also TypedClojure (https://github.com/clojure/core.typed https://github.com/clojure/core.typed) which is based on Typed Racket (is what I read in previous discussions about it here).