News for hackers. Stuff that matters.
Re:Ask HN: What metaprogrammable language do you/would like ... by markknol on Tuesday April 23, 2019 @05:59AM (#19727013)
This list is missing Haxe, which is strictly-typed (with type inferencing), supports object-oriented, generic, and functional programming and is highly extensible thanks to meta-programming (macros). Interoperability is where it excels, since it compiles to to multiple language targets/platforms, including VM bytecode.
Re:Ask HN: What metaprogrammable language do you/would like ... by klntsky on Tuesday April 23, 2019 @06:09AM (#19727065)
Note: Haxe does not typecheck macros.

See https://haxe.org/manual/macro-ExprOf.html

For example, this seemingly ill-typed definition (which should return Int as suggested by the type paramater, but in fact returns a string) successfully typechecks:

  class StringGetter {
    public static macro function getString():haxe.macro.Expr.ExprOf<Int> {
      var s:String = "";
      return macro $v{s};
    }
  }
Re:Ask HN: What metaprogrammable language do you/would like ... by b2d on Tuesday April 23, 2019 @06:18AM (#19727116)
Incorrect. To quote the page you've linked: "For the most part, this type is identical to Expr, but it allows constraining the type of accepted expressions." or otherwise put: ExprOf only affects macro arguments, not return value. What you want is this:

  class StringGetter {
    public static macro function getString() {
      var s:String = "";
      return macro ($v{s} : Int);
    }
  }
Re:Ask HN: What metaprogrammable language do you/would like ... by k_ on Tuesday April 23, 2019 @06:12AM (#19727082)
That's not entirely true. `ExprOf<T>` itself is not checked in either the macro function argument or return type, but that's only meant for static extension (and maybe some other features?).

Expressions generated by your macros will be parsed by the type checked. You won't be able to do

    var s:Int = StringGetter.getString();
Because you'll get a compilation error there (http://try-haxe.mrcdk.com/#48EDb).
Re:Ask HN: What metaprogrammable language do you/would like ... by nadako on Tuesday April 23, 2019 @06:14AM (#19727097)
> 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