Have a look at this:

http://cemerick.com/2011/07/05/flowchart-for-choosing-the-right-clojure-type-definition-form/

Now, as far as i understood, you define a protocol and the extend it
on types defined via defrecord.

That's more like Character is a protocol that defines functions for
movement, attacks and other things and then you extend this protocol
to Player, Monster etc. records and provide protocol-implementations
for each of these types.

It's less like packing all things into one class, more like
behavioural composition.
Your could also extend an AI protocol on your Monster-record. Then you
have a Monster, moving like a Character, controlled by an AI.

On 28 Jul., 10:12, Oskar <oskar.kv...@gmail.com> wrote:
> Hi!
>
> I have not heard much about records and protocols. What is a typical
> use case in idiomatic Clojure code for them? Is it a good idea, for
> example, to make a "Character" protocol and "Player" and "Monster"
> records or something in a game. It feels a bit too much like OOP for
> me to be comfortable with it, but I can't immediately see why that
> would be bad. I just don't know how they are supposed to be used.

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