[sorry for duplicating content from the email i sent you David]

Would anyone be interested in simplifying some of the boilerplate for
defining methods in clojs? Currently you have to do this,

(defclass circle [shape]
  (:radius 10))
(defmulti area :tag)
(defmethod area ::circle [this] (* (:radius this) (:radius this) (Math/
PI)))

But it seems like 99% of the time this is boilerplate b/c you want
multi-methods to dispatch on :tag, so we should maybe have a shortcut
to let us do this...

(defclass circle [shape]
  (:radius 10)
  (defmethod area [] (* :radius :radius Math/PI)))

I'm not a macro-wiz but it must be possible to alter that defmethod to
check if it's defined and to wrap the symbol refrences with (:symbol
this) and cons this to the argument list.

Just a thought, Aria

On Jan 22, 7:55 pm, "evins.mi...@gmail.com" <evins.mi...@gmail.com>
wrote:
> On Jan 19, 12:38 am, David Nolen <dnolen.li...@gmail.com> wrote:
>
> > Of course it might be the case that not many people are interested in the
> > implementing ideas from CLOS for Clojure
>
> It's definitely interesting. I'd like to have eql specializers and the
> ability to build hierarchies of arbitrary types (e.g. a hierarchy of
> strings for one particular application I'm working on), so any hacking
> around with CLOS-like dispatching and specializers is interesting to
> me.
--~--~---------~--~----~------------~-------~--~----~
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
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to