Clojure 1.7 finally saw a feature many people have been asking for — reader conditionals. It enables writing of platform-independent reusable code, where by platforms I mean Clojure, CLJS or ClojureCLR. With reader conditionals you can write code like this:
[1 2 #?@(:clj [3 4] :cljs [5 6])] ;; in clj => [1 2 3 4] ;; in cljs => [1 2 5 6] ;; anywhere else => [1 2]
This is cool, but unfortunately the list of features is currently limited to
just three platforms. Additionally, the only place where you can use this syntax
.cljc files. So, goodbye to leveraging this from the REPL.
On the other hand, Common Lisp has feature expressions as a first-class
feature. Developers are free to define their own features and use them anywhere
they like. And while this may create chaos and requires strict agreements
between colleague, the feature itself is quite useful. Features like
:prod are quite prevalent in Common Lisp projects, and often they
substitute other means of configuration and build type separation.
So, for the above reasons, and mainly for fun, I decided to hijack the new reader conditionals functionality to make it extensible and omnipresent.
Disclaimer: do not use this in your projects and do not think it is acceptable to do such things in real life. In fact, forget everything you're going to see here.