Hello,

While not checking types at compile time, it seems to me that a lot of
clojure code still needs in the docstring some sort of "preconditions
warnings".
For example, that you can't pass a first argument if it cannot be callable
as a function, or if it cannot succeed the (seq) test ...

Couldn't it be great if such a knowledge wasn't captured in the doc string,
but in something that could be more useful (optionally of course, for
performance purposes) : some sort of optional precondition part of the
function/macro definition. Of course, this would then be written in clojure
itself.

This information could then be :
 * added at the beginning or end of the docstring (or put in another
docstring) at compilation time
 * added as an optional precondition check each time the function is called
(activable globally via some global var that could be named
*check-preconditions* for example)

Indeed, I guess it's easier to fail quickly when something goes wrong, but
if the argument is passed over some other function, and used later in some
agent, or deeper in the code, I guess it is sometimes hard to identify where
things started to go wrong (or maybe it is not such a problem with clojure
?)


I feel sorry to see and place in the docstrings structured information that
could be (optionally, of course) expressed in a more structured format ...


What do you think about that ?

Regards,

-- 
Laurent

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