Created
August 12, 2010 20:46
-
-
Save c-spencer/521695 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defprotocol TestProtocol | |
(test-method [this])) | |
(deftype MutableLocking | |
; Compiles ok | |
[^{:volatile-mutable true} mut-var] | |
TestProtocol | |
(test-method [this] | |
(locking this | |
(set! mut-var {:set true}) | |
this))) | |
(deftype MutableLockingFailure | |
; Placing return value outside of locking | |
; Fails to compile, complaining mut-var is not mutable. | |
[^{:volatile-mutable true} mut-var] | |
TestProtocol | |
(test-method [this] | |
(locking this | |
(set! mut-var {:set true})) | |
this)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment