Hi,
On 5 Dez., 00:38, Randall R Schulz <[EMAIL PROTECTED]> wrote:
> Actually, I think each arity overload of a function deserves to be
> independently documentable, just as each overload of a method name in a
> Java class would be.
I disagree. If the function of the function changes that much, that
you need a different docstring just because you pass in a different
number of arguments then there is something terribly smelly.
What are the major use cases of variable arity?
For me this is default values:
(get a-map a-thing the-default) vs. (get a-map a-thing)
(sort comparator a-collection) vs. (sort a-collection)
This does not deserve a different docstring. This can be well
handled in one.
> The details of what (doc ...) would present in such cases would have to
> be decided and, perhaps more significantly, the way the metadata was
> structured would have to be revamped, and that may entail non-
> backward-compatible changes (to any code that examines the metadata on
> Vars that hold functions).
I don't think, that this change is worth the trouble.
> And am I mistaken in my reading of the API docs for (defmulti ...) and
> (defmethod ...) or is there no accommodation in either for doc-strings?
> Surely that's not the case, right?
You can always use:
(defmulti #^{:arglists '([a b] [a b c]) :doc "bla"} foo identity)
Docstrings for individual defmethods are not possible. While
I also wanted to use it before. Rich convinced me, that it is
a smell when I have to.
Sincerely
Meikel
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---