In Ruby, method_missing is one of the basic metaprogramming constructs. It is closely related to the object-oriented structure of Ruby, dynamically creating methods in a class from "metaclasses". This can be done because Ruby classes also have objects.
Since Clojure is a functional language, there is little point in imitating this rubism. However, one of the main Lisps idioms (like Clojure) is that code is data: and since code can generate data, it can also generate code. The main way to do this metaprogramming in Lisp is through macros.
I would suggest learning more about macros and their dos, etc. Be careful though, as with Ruby, dynamically generated code is usually harder to debug and maintain. Often, clever use of other functional idioms may be the best structural solution.
Nielsk
source share