A few ideas

0 views
Skip to first unread message

Howard Lewis Ship

unread,
Jun 4, 2009, 8:31:09 PM6/4/09
to clo...@googlegroups.com
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). 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

Chouser

unread,
Jun 4, 2009, 11:26:55 PM6/4/09
to clo...@googlegroups.com
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

Howard Lewis Ship

unread,
Jun 5, 2009, 4:55:26 PM6/5/09
to clo...@googlegroups.com
It would be nice if (doc) adapted to the type of thing (function,
etc.) that is being displayed, that nil (where parameters would
normally show) is ugly. Very low priority, of course.
Reply all
Reply to author
Forward
0 new messages