On Thu, Jun 4, 2009 at 8:31 PM, Howard Lewis Ship<hls...@gmail.com> wrote:
>
> I was one of the lucky people who got to chat directly with Rich in SF.
>
> 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).

(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

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