3 ms·
If macros can implement arbitrary language features then how come elisp has never built a type system?
by KeenanKeenan 2mo ago
If macros can implement arbitrary language features then how come elisp has never built a type system?
- deleted 2mo ago[deleted]
- wk_end 2mo agoWell, not elisp, but https://coalton-lang.github.io https://coalton-lang.github.io or maybe https://shen-language.github.io https://shen-language.github.io
- KeenanKeenan 2mo agoTyped racket too, might I add. I just imagine static typing around stable core APIs would help users understand how eglot and vertico compare to prior art. The way I learned how the completion stack works was to ask claude to show me what the elisp entrypoints would look like if implemented in typescript. It's not because I'm unfamiliar with lisp, I'm not, it's just easier to reason with the world in terms of data structures and their contracts.
- anthk 2mo agoCL is the big cousin of Elisp, almost.
- BeetleB 2mo agoI would expect you can. lexilambda created Typed Racket on top of Racket. https://github.com/racket/typed-racket https://github.com/racket/typed-racket
- ashton314 2mo agoAnother approach, using macro expansion to perform the type checking: https://docs.racket-lang.org/turnstile/ https://docs.racket-lang.org/turnstile/ Turnstile relies on the fact that in Racket, you can have identifier macros [1] which can be expanded in pretty much any location (except binding, naturally). Racket is unique in this regard. Clojure has a mechanism to get roughly the same thing, but it's complicated. [2] 1: https://docs.racket-lang.org/guide/pattern-macros.html#%28part._.Identifier_.Macros%29 https://docs.racket-lang.org/guide/pattern-macros.html#%28pa... 2: https://lambdaland.org/files/2024_ecoop_type_tailoring.pdf https://lambdaland.org/files/2024_ecoop_type_tailoring.pdf
- iLemming 2mo ago[flagged]
- drob518 2mo agohttps://typedclojure.org/ https://typedclojure.org/
- hayley-patton 2mo ago> If macros can implement arbitrary language features Not really your question--others have provided examples of type systems as macros--but they can't, they can only do local rewrites. You couldn't, for example, express mutation or non-local control flow if you didn't have them already; On the expressive power of programming languages [0] is rather theoretical but does set out the boundary of what macros can and can't do. That they're local means everyone has to buy into your type system if you want it to be a macro, though. [0] https://www.sciencedirect.com/science/article/pii/016764239190036W https://www.sciencedirect.com/science/article/pii/0167642391... though https://www.youtube.com/watch?v=43XaZEn2aLc https://www.youtube.com/watch?v=43XaZEn2aLc might be a useful walkthrough of the ideas being presented