Welcome! Please see the About page for a little more info on how this works.

+1 vote
ago in Compiler by
edited ago by

It is a relatively well-known fact that do, when used at the top level of a namespace, lifts its children to the top-level. Which makes it suitable for e.g. writing macros that emit code that requires some namespace and immediately uses it.

That behavior is relied upon by existing libraries and is described online in various places, but it's not documented at https://clojure.org.

Perhaps it makes sense to explicitly document this particular quirk of do and its usage.

1 Answer

0 votes
ago by

What needs to be doc'ed about it?

ago by
The fact that it is an expected behavior that can be relied upon and not a happenstance that should be avoided. See the original discussion with differing opinions here: https://clojurians.slack.com/archives/C03S1KBA2/p1752422724214819
...