Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Almost, but not quite. I'll quote a few key phrases from [1] to distinguish between what I want and transients, though I imagine in real life transients probably capture most use cases fairly well.

The second feature of transients is that creating one does not modify the source, and the source cannot be modified via use of the transient. Your source data is immutable and persistent as always.

Note in particular that transients are not designed to be bashed in-place.

The unique linear pointer would allow direct in-place mutation of the source. As it is guaranteed to be unique, no synchronization is needed. Transients do not modify in-place and do not allow you to mutate the source type directly, but allow you to add to the source and the added data is mutated directly for performance. There is a lot of overlap in use cases and transients are an excellent middle ground for Clojure, since it allows you to code against immutable types but with the performance benefits of partial mutation. The pointers I described would be less flexible in that you cannot have references to an immutable portion as you can in Clojure, but at the same time the owning code has completely mutable access.

In general, I love Clojures concurrency model and I don't think unique pointers would really mesh well with the rest of Clojure.

[1] http://clojure.org/transients



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: