News for hackers. Stuff that matters.

nadako

> Haxe does not typecheck macros.

That is a weird statement. Haxe expression macros by definition return untyped AST to be processed further normally by the typer, just like hand-written code. And it will be type-checked. And then there's an AST node existing exactly for type-checking (or, rather, type unification) that you can generate to insert custom checks: https://haxe.org/manual/expression-type-check.html

Oh, and regarding "how compact are your programs", well every time I see boilerplate code or reflection usage that cannot be refactored into something nice without sacrificing clarity and/or performance, I use meta-programming to generate it instead.

Usual suspect here is any kind of "support" code, like serialization, RPC, dependency injection and such.

Haxe has pretty good metaprogramming capabilities. It has expression macros (compile-time evaluated calls that return expressions to be inserted at call place) as well as type-building macros (build fields and/or define whole new types). Both have access to compiler and system API and information about the context (e.g. expected type).