On Nov 13, 9:03 am, MikeM <[email protected]> wrote: > > (deftype Foo [a b c]) > > > (defprotocol P (bar [x] "bar docs")) > > > (extend ::Foo P {:bar (fn [afoo] :foo-thing)}) > > A common error may be to: > > (extend Foo P {:bar (fn [afoo] :foo-thing)}) > > when (extend ::Foo ... is intended. I notice that (extend Foo... > doesn't throw - should extend check that it is supplied a class, > intfc, or keyword and throw if something else is supplied?
Yes it could. > Alternately, could extend be changed to allow (extend Foo ... and do > the right thing ? ie determine that Foo is the constructor function > for a type and do the extension for the type Foo. Dunno yet - there isn't a path from the factory fn value to its name or deftype. Rich -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to [email protected] Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/clojure?hl=en
