On the Clojure 1.80-beta2 release thread <https://groups.google.com/forum/#!topic/clojure/_AGdLHSg41Q>, Ambrose Bonnaire-Sergeant mentioned that he is monkey-patching clojure.core/load to provide "an extension pointfor alternative compilers". I can see several possibilities for such an extension:
- Alternative readers / sources - Parse another language (e.g. Python) into Clojure forms - Non-file sources (e.g., load code from database) - Use a custom compiler - Apply a transform (e.g., transform to continuation passing style) I think the Clojure community would benefit from having such an extension point built into core. I'm starting this thread to facilitate discussion on how such an extension might look and function. To that end, I'm certainly open to suggestions regarding interfaces, etc. In the interest of kicking off discussion, however, I think a simple "namespace loader" analog of Java's ClassLoader would go a long way towards satisfying the above use-cases. A simple way to represent a namespace loader would be as a function that accepts a namespace name and returns a namespace (if the given namespace was loaded) or nil (if the given namespace was not found). If the namespace was "found", but could not be loaded for some reason (e.g., syntax error), the function throws an appropriate exception. Namespace loaders could be specified by adding them to clojure.core/*namespace-loaders*, a dynamic var containing a list of namespace loaders. Namespace loaders are tried in turn until the given namespace is found or the end of the list is reached. In the latter case, loading fails. So, what do people think? Am I missing some point in analysis? Would such extensions be considered useful, or does it unnecessarily complicate namespace loading? Any alternative designs you feel would be better? Nathan Davis -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com 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 clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.