On 2011-08-28, at 2:27 PM, Luc Prefontaine wrote:

> On Sun, 28 Aug 2011 14:19:46 -0400
> Alexandre Patry <patry...@iro.umontreal.ca> wrote:
> Some reading:
> 
> http://david-mcneil.com/post/1475458103/implementation-inheritance-in-clojure

Thanks for the quick answer.

>From what I understand, this article talks about inheritance of 
>implementation. I would like inheritance of "specification", like :

(defprotocol State
  (precede? [this other-state])
  (completed? [this]))


(defprotocol Hypothesis
  ;; Here, I would like to specify that an hypothesis must implement the State 
protocol

  ;; but also the value and successors functions
  (successors [this])
  (value [this]))

It would be simple interface inheritance in java, but I do not know how to 
express it in clojure.


> 
> Luc P.
> 
>> Hi,
>> 
>> I would like to define a protocol as a super set of another. For
>> example:
>> 
>> (defprotocol P1
>>  (f [this]))
>> 
>> (defprotocol P1WithExtras
>>  ;; something like :extends P1
>>  (g [this]))
>> 
>> ;; P1WithExtras should now contain f and g.
>> 
>> I may have missed, but I did not find how to do it from the
>> documentation.
>> 
>> Any suggestions on how to define a protocol as a superset of another?
>> Or on an alternative solution?
>> 
>> Thanks,
>> 
>> Alexandre
>> 
> 
> 
> 
> -- 
> Luc P.
> 
> ================
> The rabid Muppet
> 
> -- 
> 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

Reply via email to