Re: How to derive a protocol from another protocol?

2010-06-18 Thread Nicolas Oury
I believe that too.

It is not clear to me why you would need that without static typing.


On Fri, Jun 18, 2010 at 10:50 PM, David Nolen wrote:

> Unless I'm mistaken, protocols cannot be derived.
>
> David
>
> --
> 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
>

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

Re: How to derive a protocol from another protocol?

2010-06-18 Thread David Nolen
Unless I'm mistaken, protocols cannot be derived.

David

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

How to derive a protocol from another protocol?

2010-06-18 Thread Travis Hoffman
I'm trying to develop a hierarchy (of sorts) of protocols and I'm
coming at it in from a Java Perspective, which I fully understand
might be my problem. In Java, I would do something like this:

interace A {
  public void aFoo();
}

interface B {
  public void bFoo();
}

interfacece AB extends A, B {
  public void abFoo();
}

Then, I could have some objects that implement A, or B or AB (for
both). I'm trying to accomplish something similar with protocols in
Clojure, but I don't see how to. I would have expected that I could
have done something like (extend-protocol AB A B) to accomplish this.
It seems, however that I have to provide a concrete implementation in
that case.

I see that there is "satsifies?" function which determines if an
instance meets a protocol. Then, to implement the protocol, we use
"extend-protocol". It seems that it would make sense to implement a
protocol with "satisfy-protocol" -- as extend-protocol does now...and
then to use "extend-protocol" to create a new protocol based upon a
simpler protocol.

Can anyone describe the correct approach for extending protocols?

Thanks!

-Travis

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