A good place to look for examples is protocols.clj and gvec.clj in clojure itself. protocols.clj includes an example of implementing a protocol on nil.

Stu

On protocols:
- doc string coming after the arg vecs seems odd. I'm used to putting
them after the "name" of whatever I'm working on.

On protocols doc:
- "You can implement a protocol on nil ... Object": could you
elaborate on how these work and/or provide examples? I think this will
solve the one problem I was running into earlier.
- "given a protocol my.ns/Protocol, an interface my.ns.MyProtocol":
the final segments don't match.




On Apr 22, 9:53 am, Rich Hickey <richhic...@gmail.com> wrote:
I have been doing some work cleaning up the design and implementation
of datatypes and protocols in preparation for the 1.2 release. Some
notable changes for those who have been working with the earlier
versions:

deftype/reify now take an explicit 'this' argument in method sigs.
The :as option is gone.

There is a new datatype construct, defrecord. defrecord includes the
implementation of persistent map, and the IPersistentMap magic of
deftype is gone.

deftype and defrecord create named classes, even in non-AOT use. There
is no factory fn created, instead you can just call the constructor.

The types for defrecord, deftype and definterface are automatically
imported into the defining namespace.

Substantial performance improvements to extend, and to higher-order
use of protocol fns.

In addition, I have started documenting these on the clojure.org site, and you should use this documentation instead of the wiki design docs,
which will not be maintained.

http://clojure.org/protocolshttp://clojure.org/datatypes

Please note that these are just higher-level descriptions, and contain
links to the detailed function docs, which are a must-read prior to
use.

Feedback and errata welcome as always,

Rich

--
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 
athttp://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

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