"Jim - FooBar();" <jimpil1...@gmail.com> writes: > Ok my bad...for a second there I thought that a defrecord expression > returns a Var but it doesn't. It returns a Class object. You can't put > anything on that therefore 'doc' won't work on it anyway.
Hm, well, the only thing a record has to document are its fields. (The methods should already be documented by the protocols.) And since a defrecord generates a constructor function ->MyRecord, you could alter its metadata. --8<---------------cut here---------------start------------->8--- user> (defrecord Point [x y]) user.Point user> (doc ->Point) ------------------------- user/->Point ([x y]) Positional factory function for class user.Point. nil user> (alter-meta! #'->Point update-in [:doc] str "\n x and y are the coordinates.") {:ns #<Namespace user>, :name ->Point, :arglists ([x y]), :column 1, :doc "Positional factory function for class user.Point.\n x and y are the coordinates.", :line 1, :file "/tmp/form-init3254591993268451432.clj"} user> (doc ->Point) ------------------------- user/->Point ([x y]) Positional factory function for class user.Point. x and y are the coordinates. nil --8<---------------cut here---------------end--------------->8--- I think that it would be useful if defrecord would have an optional docstring (or just mangle :doc metadata attached to the record name) that would be appended to the generated docstring like above. (Ditto for deftype.) Bye, Tassilo -- -- 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 unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.