On Jan 23, 2009, at 4:13 PM, Konrad Hinsen wrote:
How about something like (let [my-factor (* 3 (. Math sqrt 2) (. Math log 42.))] (defn foo [x] (* my-factor x))) where the let outside of the definition makes sure the constant factor is evaluated only once?
Are you pointing out that closures as well as macros may require same- world compilation?
When compiling that to bytecode, one could implement (effectively): (declare-private _my-factor-311) (defn foo [x] (* _my-factor-311 x)) (defn _static-initialize [] (.bindRoot (var _my-factor-311) (* 3 (Math/sqrt 2) (Math/log 42))))and arrange to call a lib's _static-initialize function whenever a compiled lib is loaded.
--Steve
smime.p7s
Description: S/MIME cryptographic signature