require should try to automatically load a corresponding .clj file with require-macros semantics


  • Type: Enhancement Enhancement
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Declined
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:


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 [foo :as f]) (:require-macros [foo :as f])

Require is for loading libs, not files, as stated in . 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.



Vote (0)
Watch (0)


  • Created: