Skip to content

Instantly share code, notes, and snippets.

View narkisr's full-sized avatar

Ronen narkisr

View GitHub Profile
@philoskim
philoskim / cljs-ns.adoc
Last active May 4, 2018 08:49
How to get *ns* string in ClojureScript

How to get *ns* string in ClojureScript

It’s not so easy to get *ns* string in ClojureScript as you might expect but here is a tip.

It is impossible to get *ns* string at run-time in ClojureScript (except in self-hosted ClojureScript) but it can be accessed at compile-time only. So you have to use a macro to get it as the following example.

I came up with this idea in the course of implementing set-ns-blacklist! and set-ns-whitelist! (https://github.com/philoskim/debux#debux-config) in my debux library.