Clojure solves this problem in a very simple way: Not at all.
Two Reasons:

There is no way to create a class with private members in clojure.
'private members' exist because of lexical scoping and don't require
special constructs like 'private' etc. (javascript has 'private
members' too because of that)

The other reason is even more simple. Because locals/parameters (and
autogenerated fields) are immutable, there is no need to access a
private member from outside its class. The field's value can just be
copied into the closure's class.


Generally there is less emphasis on (strict) encapsulation in clojure,
e.g. there are namespace-private variables in clojure, but they just
aren't exported but still can be accessed from outside.

Alex

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

Reply via email to