java - Is my clojure code being AOT compiled? -
i have maven project mix java , clojure code of clojure-maven-plugin.
i have clojure namespace this:
(ns org.myproject.clojure (:gen-class)) (defn do-stuff [] (println "doing stuff"))
and java, call like:
ifn require = clojure.var("clojure.core", "require"); require.invoke(clojure.read("org.myproject.clojure")); ifn do_stuff = clojure.var("org.myproject.clojure", "do-stuff"); do_stuff.invoke();
when running code, "doing stuff" correctly being printed screen. moreover, can see .class files clojure code inside generated jar maven. despite that, i'm still not sure what's clojure doing when require namespace. compiling whole thing on again? or code being aot compiled setup?
finally, there way can treat clojure code "regular" java functions? is, importing org.myproject.clojure , calling do-stuff regular function? given clojure generating bytecode code. don't see why java couldn't call being bytecode compatible.
require not compile code, loads necessary classes dynamically. code compiled, unless of course call compile
on file.
second, cannot use clojure functions java functions, because not same thing. can see, clojure functions objects implements ifn
, have invoke
methods. don't think using directly java methods feasible: have call methods on classes or instances, objects owns methods? further, using objects implement functions means first-class , can change bindings @ runtime, dynamicity about.
Comments
Post a Comment