Inconsistent macro require behaviour

Description

It is my understanding that a namespace has to :require-macros itself to have its macros accessible automatically but this no longer seems to be accurate.

Given this minimal example

I would expect a warning for lib/foo since demo.lib has no :require-macros for its macros and the demo.test did not use :include-macros or :refer-macros.

Compiling this via the build API does in fact produce the expected warning but only iff the demo.lib CLJ namespace was not required anywhere else.

Enabling the (require 'demo.lib) in the build.clj causes the warning to disappear and the code uses the macro properly.

Some popular libraries (eg. devcards) do not self-require but still work if the macro file was at least required somewhere else.

Is this intended behaviour or just accidental?

Environment

None

Activity

Show:

Mike Fikes July 23, 2018 at 1:02 PM

See

David Nolen January 3, 2018 at 2:44 PM

It's accidental in a sense - the macro resolution is simple to the point of being a bit naive. I'm not sure if we should do anything about it at this point. It would probably cause quite a bit of breakage and little benefit.

Details

Assignee

Reporter

Priority

Created January 2, 2018 at 11:46 AM
Updated July 23, 2018 at 1:02 PM