4 ms·
> I am not feeling ready to memorize all the field names, I prefer to have an object with documentation for each field. Using data doesn't preclude documenting
by weavejester 6y ago
> I am not feeling ready to memorize all the field names, I prefer to have an object with documentation for each field.
Using data doesn't preclude documenting fields, particularly if those fields are assigned a unique name.
For example, in Clojure you'd namespace the keys, so instead of "lastName" one might write :author/last-name instead. This keyword can then be documented or even assigned a type/spec.
(That said, you can't currently assign a docstring to a keyword in Clojure without the use of a third party library, or using a comment or external document. Hopefully a future version of Clojure will make this part of the core language.)