Reproducible Code: https://gist.github.com/patrickgombert/1bcb8a051aeb3e82d855
When using a volatile-mutable field in deftype, compilation fails if the field is set! in a method call that uses both try..finally and returns itself from the method call. Leaving out either the try..finally or returning itself from the method causes compilation to succeed.
Expected behavior: set! should set the volatile-mutable variable and compilation should succeed.
clojure 1.6.0, clojure 1.7.0-beta1
this must be the same issue as and CLJ-701, it has nothing to do with returning `this`, but with the try being in a tail position or not. if the try is not in a tail position the compiler hoists it out in to a thunk. effectively the code is
which the compiler also rejects, because it doesn't let you mutate fields from functions that are not the immediate protocol functions