On Apr 18, 3:16 pm, jon <
superuser...@googlemail.com> wrote:
> Here's my technique for addressing this issue.. which I think could be
> a worthwhile addition to core clojure since it's in keeping with "the
> clojure way".
>
> I created a generic CljExeption which extends Exception and implements
> IObj so that it supports metadata. (Code attached below, which I
> compile against clojure.jar)
>
This looks like a nice use for meta data.
I had another thought on the issue raised by jim - how to create a
java subclass in clojure. Proxy lets us do that, but it doesn't allow
us to name the class. Reading proxy.clj, it seems that proxy could
support optional user-naming of proxy classes. In proxy.clj :
(defn get-proxy-class
...
cname (str "clojure/lang/" (gensym "Proxy__"))
The optional name would be used in place of the gensym'ed
clojure.lang.Proxy...
This would be useful for jim's case, where the naming of the proxy
class would allow straightforward use of try..catch. There are
probably other cases where this would be useful.
Issues to address - attempts to re-use a class name, what to do if the
proxy class already exists with a name different than that specified
by the optional classname arg. I guess this is a question for Rich or
perhaps someone else with a deeper understanding of how proxy works.