[CLJS-563] require should try to automatically load a corresponding .clj file with require-macros semantics Created: 29/Jul/13 Updated: 10/Dec/13 Resolved: 10/Dec/13
A common pattern in CLJS projects is to have macros in the .clj file with the same name as the .cljs file. The loading of such namespace is than usually done as follows (see also this comment) :
Require is for loading libs, not files, as stated in http://clojure.org/libs . I propose to define a lib in CLJS as a pair of files, one with .cljs and one with .clj, with either file being optional. That way the special macro loading in CLJS will be transparent to the user.
With this change, require should thus try to always load also a corresponding .clj file and treat it as it would with require-macros. Only one file type (.clj or .cljs) should be required for require clause to be successfull.
require-macros functionality should be left unchanged, to allow a backward compatibility.
Don't know about the implementation details of this enhancement, but probably only analyzer.clj will have to be changed. An open question is the functionality and implementation of the :refer in such modified :require.
|Comment by David Nolen [ 10/Dec/13 9:18 AM ]|
the solution proposed for