On 2010 Apr 5, at 9:43 AM, Per Vognsen wrote:
I already mentioned this in my original response, but it's worth
reiterating that the situation is very much like a relational database
system. In a relational database there are no direct pointers, only
primary keys. A primary key is nothing more than an identifier; it
becomes a specific reference only in the context of a table.
So despite initial appearances it's actually a very familiar
programming model.
It is too bad that clojure doesn't do that uniformly, otherwise I
might get used to having sets of sets instead of sets of handles to
sets that I have to dereference manually, as I would do with a database.
Smalltalk has become: to address entire classes of problems like this
one.
(a quick/modern overview of become:
http://gbracha.blogspot.com/2009/07/miracle-of-become.html)
If clojure had become (I don't know enough about internals), you could
do:
start transaction
Make A
Make B, referring to A.
Make A', referring to B.
A become: A' (swap the contents, but not the identity)
end transaction.
The transactional isolation prevents A and B from being visible before
they are finished.
Reifying the relationship would be another kind of indirection also
commonly used in databases.
-Doug
--
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
To unsubscribe, reply using "remove me" as the subject.