Hacker News new | ask | show | jobs
by Raphael_Amiard 5050 days ago
The haxe macro reads the file at runtime. Your clojure macro reads the file at compile-time. The proper version would be :

    (defmacro get-file-contents [s]
      (if-not (string? s)
        (throw (Exception. "Expected string"))
        `(slurp ~s)))
1 comments

Nope, the Haxe program reads and includes the file at compile time, but only if it's a string literal. If it's an expression that evaluates to a string (which only works if you have static typing, as Haxe does), it reads it at runtime. If its neither it fails.