Better HN
topnewbestaskshowjobs
Log inSign up

nadako

6 karma · joined Mar 16, 2015 (11y ago) · 4 submissions

Submissions

comment 7y ago · link · parent

> 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

comment 7y ago · link · parent

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.

comment 7y ago · link · parent

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).

4.

New Haxe language feature: import.hx(haxe.org ↗)

3 points · by nadako · 10y ago · discuss