Error formatting macro: pagetree: java.lang.NullPointerException
Skip to end of metadata
Go to start of metadata
You are viewing an old version of this page. View the current version. Compare with Current  |   View Page History

Rationale

I'm writing a type checker for Clojure code that utilizes a modified version ClojureScript analyzer.

I have made some changes to the analyzer to analyze Clojure code, instead of ClojureScript.

These changes could form the basis of a generalized analyze library to be called a la carte.

Challenges

Analyzer doesn't understand macro definitions (defmacro's)

  • before parsing a namespace, we `require` it so we can call any macros defined in it during analysis
  • ClojureScript macros are Clojure macros, same approach
    • but CLJS doesn't have the problem of using macros defined in a namespace we are analyzing, but same solution

Dynamic loading and aliasing

  • ClojureScript has no compiler at runtime, so all dependencies and aliases are known at compile time
  • Clojure has `refer`, `require`, `import`, `alias`
    • Can be called dynamically at runtime
      • Impossible to compute all dependencies at runtime
        • Seems like a losing battle
          • Could we analyze clojure.core? Uses dynamic `load`, `require`
          • clojure.main?
Labels: