3 ms·
> How so? Can we program Haskell's Hindley-Milner based type checking into Lisp with macros and homoiconicity, and have it run during compile-time? I don't see
by wtetzner 9y ago
> How so? Can we program Haskell's Hindley-Milner based type checking into Lisp with macros and homoiconicity, and have it run during compile-time?
I don't see why not. Typed Racket does more or less that (it's not Hindley-Milner, but that's because they wanted a type system that matched Scheme idioms better): https://docs.racket-lang.org/ts-guide/ https://docs.racket-lang.org/ts-guide/
> I have done my fair share of meta-programming with Ruby and I realized I really didn't want the power to change my program model at runtime. While they made certain things easier - like Rails's ActiveRecord (which is superb btw) - the "inception"-like indirection made things very hard to reason about.
Lisp macros run only at compile time. You can just ask the REPL (or your editor) to expand a particular macro invocation for you to see what code is generated.
Of course, macros are still typically harder to debug than functions, but sometimes macros are the only way to abstract a certain pattern. That's why Template Haskell, CamlP4, OCaml extension points, etc. exist.
> So far, statically typed FP with Sum Types and Pattern Matching and Immutability seems to be the cure, and macros and dynamic typing its very antithesis.
I would argue that macros complement statically typed functional programming. Again, there's a reason for Template Haskell, CamlP4, OCaml extension points, etc.
> For me the secret-weapon language is less about power, and more about structure.
Yeah, this is where OCaml's module system shines.