What's the latest opinion on parsing and representing clojure code as data?
I'm talking about representations suitable for code analysis; representing the definition of the program as specified by the programmer. As opposed to: 1. a representation of the program implied by the source code (aka read) 2. a representation of the document that represents the source code. (aka sjacket) To summarize the issues with read: 1. Reader macros like ` cause significant difference between the source code and the return value of read. This is a problem for code analysis (and complicates the matter of error messages..) 2. Read is tied to the state of the system. This means you cannot 100% reliably and securely read arbitrary clojure source. *Read-eval* is a tradeoff - you won't trash your env, but at the cost of not being able to perceive the full domain of clojure source. And regardless the setting of *read-eval*, mere perception is contingent on state: constructors will blow up if you don't have the class. The state problem is not only an edge case of JVM-clojure interop. It also comes up in cljs compilation, where one is reading cljs source within the clj reader and must be careful. And of course, its a problem if you want to analyze a large amount of arbitrary source code :) I'm aware of sjacket, but that's more about representing the document, not the program description. Are there other things out there? I think there are 2 representations that could be useful: 1. as pure EDN data that encodes the various reader macros within the strict EDN subset, as a kind of minimal AST 2. as datoms in datomic, suitable for integration with codeq and more forward-thinking ways of managing programs. Besides use in tooling, I also think of this as a "serializable-fn"-plus, more useful in distributed systems because of safer, easier analysis and transformation. Anyway, was wondering who else has thought about this, and has some potential designs, implementation approaches, repos, opinions, etc -- -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to [email protected] Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
