Hi,

I found some posts about this topic, but they did not clarify things
in my head well enough, so I have to start my own... :)

I'm basically craving for multiple inheritance or mixins, at least
with my current way of thinking. I haven't really gone deep enough
with multimethods or protocols, so I might be a little off track by
looking for multiple inheritance.

Let's take an example:

I want to implement some gui widgets, so there's a main method
"render" which draws the widget on the screen. I want to have two
types:

- Textfield
- Datetimepicker

Each can be "mixed" with the Label widget, so that we have:

- LabelledTextfield
- LabelledDatetimepicker

So, two challenges occur:
1/ the render method for Label needs to call the render method for
it's "mixed" widget (either Textfield or Datetimepicker) - let's
assume that labels are rendered "around" the actual widget, so that we
have a simple way to mix the implementations of render method
2/ the Label widget comes with its own data (the label text)

For the second thing, I think it will work with defrecords, since the
label can be a map entry which can be stored in the actual widget,
even if it's not mixed with Label. I still want to point this out in
case there are other ways of achieving this.

How can I achieve 1? Are there alternatives for 2?

Thanks for reading,
Razvan

-- 
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

Reply via email to