Tassilo Horn: > Generally, proxy is for creating proxy objects, and the generation of a > class is more or less a side effect. > > Do I see it correctly that you need a way (1) to have objects > implementing Job which (2) can be instantiated with a zero-args > constructor and (3) whose execute behavior is customizable by providing > an arbitrary function f on the JobExecutionContext? >
Correct. > If so, I don't see a too good way. deftype would be usable if the > function f would be specified as a field of the type, but then it has no > zero-args constructor... > > You probably could rewrite your using-fn as a macro where a call like > (using-fn foo) expands into something like > > (deftype MyJob_foo [] > Job > (execute [ctx] > (foo ctx)) > > for any function foo, plus the registration of MyJob_foo with that > JobBuilder thingy. Of course, a second call (using-fn foo) should skip > the definition of that already existing type. Yes, using a similar macro around defrecord or deftype was my backup plan. Thank you. MK -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en