Hacker News new | past | comments | ask | show | jobs | submit login

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



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.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: