Dear all,

Clojure 1.2.0

(deftype A [ ^{:unsynchronized-mutable true} foo ]
                                                           Object
                                                           (hashCode
[x] (set! foo :foo)
                                                                              5

       ))

works very nicely.


(deftype A [ ^{:unsynchronized-mutable true} foo ]
                                                           Object
                                                           (hashCode
[x] (try (set! foo :foo))

                                                                     ))


also works.


(deftype A [ ^{:unsynchronized-mutable true} foo ]
                                                           Object
                                                           (hashCode
[x] (try (set! foo :foo))
                                                                     4
                                                                     ))

fails:

Cannot assign to non-mutable: foo
  [Thrown class java.lang.IllegalArgumentException]

This is less useless than it seems. (try is called within locking,
which can be useful when setting something unsynchronized)


Is it a known bug? Does it happen to other people than me?

Best regards,

Nicolas.

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