5 ms·
Macros are absolutely not a way to get around the type system. The things macros let us do are mostly orthogonal to types and there is no contradiction to havin
by tikhonj 9y ago
Macros are absolutely not a way to get around the type system. The things macros let us do are mostly orthogonal to types and there is no contradiction to having macros in a typed language. In fact, that's exactly what Template Haskell is—a macro system for Haskell. It just happens to be awkward to use for a variety of reasons.
I would go further: a typed language needs the sort of metaprogramming macros provide to avoid having too much boilerplate and noise. You can either do this with a simple, general macro system or with ad-hoc features addressing narrow usecases a macro system would cover. Haskell's deriving mechanism, record system and syntax sugar like do-notation are all great examples of things that would be obviated with a solid macro system, making the language simpler.