James Reeves <ja...@booleanknot.com> writes: > On 17 October 2014 16:21, Phillip Lord <phillip.l...@newcastle.ac.uk> wrote: >> http://en.wikipedia.org/wiki/Uniform_access_principle >> >> To my knowledge, Clojure cannot do this. >> > > Yes, Clojure pretty much rejects the idea of uniform access.
I don't think it does. I think it just does not support it which is a somewhat different thing. >> > With regard to automatically :doc string, why can't you set it when the >> var >> > is created? >> >> Two reasons. The first is specific to my library, which is that the var >> contains a mutable Java object. So the :doc string may change over time, >> independently of the value of the var. "Don't use mutable objects" would >> be an obvious response, but not a useful one in this case. >> > > If you're placing mutable objects in a top-level var, and having that var's > docstring change based on their contents, that's a strong indication you're > doing something wrong. Yes, this is certainly a possibility. > It sounds like you're trying to interoperate with a Java library that's > very structured around OOP principles, and very hard to translate into > idiomatic Clojure. My guess is that you wouldn't have the issues you > mention in a pure Clojure solution. Which is the actuality. While using mutable objects and global state may be an indication that I am doing something wrong, my belief is that starting a software project by ignoring existing java libraries and rewriting everything in Clojure is a much bigger error. I got to a usable piece of software in two months; this would not have happened from scratch. Still, although my example might appear irrelevant to Clojure in general, I don't think it is. Clojure's current docstring support is not very good (and there was a thread here about it not long ago). It would be nice to have something richer. For really rich documentation, maintaining the docstrings is a different file might make sense. Clojure can support this at the moment, but only in the way that I have -- the var metadata could be updated at load time. What it cannot do (easily) is support lazy loading of the file documentation at the point of first use, because the decision was made originally that :doc metadata is a value and is NOT computed. Phil -- 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/d/optout.