One idea I bounced off him was that it would be nice to be able to add
documentation to struct maps; both docs about the usage of the struct
in general, and further doc about each key (especially a hint about
what kind of data is stored there). Perhaps even a real type hint?
I wonder what other things could be documented this way, and what
changes to (doc) are needed to acccess them?
--
Howard M. Lewis Ship
Creator of Apache Tapestry
Director of Open Source Technology at Formos
(defstruct #^{:doc "Represents a Foo, with keys of
:bar (signal strength) and
:baz (relationship to movie director)"}
foo :bar :baz)
user=> (doc foo)
-------------------------
user/foo
nil
Represents a Foo, with keys of
:bar (signal strength) and
:baz (relationship to movie director)
nil
That's what you get for free today. I'm sure we can find ways to
improve it, though...
> Perhaps even a real type hint?
I think there are grand plans for structs that are perhaps getting in
the way of smaller improvemnts.
http://code.google.com/p/clojure/issues/detail?id=46
For example, defstruct could define a Java class with named accessors
(and "mutators"?) for the given fields.
--Chouser