Hi Toni, The key thing is that you can implement protocol on Object.
So if you have one protocol per function, (Let's call your function f1,..., fn and the protocols implementing them F1,....,Fn) You can define a default value for each function: (extend-type Object F1 (f1 ...) .... Fn (fn....)) and you have a type (let's call your type T1, ... Tm) T1, that only implements f1...fp (p <=n) (without loss of generality, up to renaming) (deftype T1 F1 (f1 .....) ... Fp (fp...)) Now, if you call fi on something of type T1. If i <=p , then the implemntation of F1 on T1 will be called. Else the default instance on Object will be called. Nota: You can makes this more type safe, by creating an empty interface HasF1_Fn (definterface HasF1_Fn), and defining the default function by extending this interface instead of Object. You then have to had HasF1_Fn to your deftype. Best regards, Nicolas. On Fri, Jul 16, 2010 at 11:29 PM, Toni Batchelli <tbatche...@gmail.com>wrote: > Hi Nicolas, > > I get the idea, but I don't see how this would help provide a default > implementation for the functions inside a protocol. It looks to me > like this would be the same as creating a record with only some of the > functions implemented. Or am I reading it wrong? > > Thanks for your input. > > Toni. > > On Fri, Jul 16, 2010 at 1:21 PM, Nicolas Oury <nicolas.o...@gmail.com> > wrote: > > I read my mail and couldn't understand it. > > Here is what I meant: > > (defprotocol MessageReceived > > (message-received ...)) > > (defprotocol ExceptionCaught > > .....) > > (extend Object MessageReceved {:message-received > > default-message-received-function}... > > ) > > (deftype channel-handler > > ExceptionCaught ....) > > (not the lack of message received implementation) > > > > -- > > 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<clojure%2bunsubscr...@googlegroups.com> > > For more options, visit this group at > > http://groups.google.com/group/clojure?hl=en > > > > -- > Antoni Batchelli > - twitter: @tbatchelli , @disclojure > --- email: tbatche...@gmail.com > ----- web: tbatchelli.org , disclojure.org > > -- > 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<clojure%2bunsubscr...@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