Hacker News new | ask | show | jobs
by b2d 2617 days ago
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);
    }
  }