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.


> When I first wrote the var, I thought it was going to be a constant.
> However, during the development of my code base, I discovered in one or
> two small uses cases, it could not be.
>

Sorry, I should have been clearer. By "constant" I meant an immutable data
structure. I wouldn't consider a Java factory object to be a constant, even
if its internal state never changes.


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

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.

- James

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

Reply via email to