If anything let's add more bangs to the name. Unlike any of atom/ref/agent, volatile! is not really part of the familiar "state model". Yes it applies a function to a thing, changing the thing. Like Luc says, not atomically.
The linux hdparm tool has the –yes-i-know-what-i-am-doing and --please-destroy-my-drive flags. Those could be useful. Maybe (binding [*please-randomly-break-my-application* true] ...) On Monday, September 8, 2014 3:22:48 PM UTC-4, Luc wrote: > > +1 for the ! > > No atomic changes here, no coordination whatsoever. > > At the mercy of the caller... > > > I asked Rich and he said "making a volatile is as dangerous as any ! > op". > > > > Some people have also asked about vswap! being a macro instead of a > method > > on Volatile. The issue there is that vswap! takes a variadic number of > > update function args. If implemented as a method, you'd need to provide > > multiple arities or eventually use apply (like in Atom's swap! > > > https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Atom.java#L79) > > > > - doing it in a macro lets that expansion take place at compile time to > > provide better performance without the apply. > > > > > > > > > > > > On Mon, Sep 8, 2014 at 1:36 PM, Jozef Wagner <jozef....@gmail.com > <javascript:>> wrote: > > > > > FYI the ticket about volatile is at > > > http://dev.clojure.org/jira/browse/CLJ-1512 and the same question was > > > raised there. > > > > > > On Mon, Sep 8, 2014 at 4:25 PM, Frantisek Sodomka <fsod...@gmail.com > <javascript:>> > > > wrote: > > > > Hello, > > > > I posted a question about volatiles on the github commit: > > > > > > > > https://github.com/clojure/clojure/commit/60440977823752f13a3fec3637538e9a1d68c5d4 > > > > > > > > > I don't know if anybody noticed, so... why is volatile created with > > > function > > > > "volatile!" and not "volatile" ? Atoms, refs and agents don't have > > > > exclamation mark in their constructor functions. > > > > > > > > Should I think about volatiles as mutable locals? :-) > > > > > > > > František > > > > > > > > > > > > On Friday, September 5, 2014 4:26:53 PM UTC+2, Alex Miller wrote: > > > >> > > > >> Clojure 1.7.0-alpha1 is now available. > > > >> > > > >> Try it via > > > >> - Download: > > > >> http://central.maven.org/maven2/org/clojure/clojure/1.7.0-alpha2/ > > > >> - Download securely: > > > >> https://repo1.maven.org/maven2/org/clojure/clojure/1.7.0-alpha2/ > > > >> - Leiningen: [org.clojure/clojure "1.7.0-alpha2"] > > > >> > > > >> Highlights below, full change log here: > > > >> https://github.com/clojure/clojure/blob/master/changes.md > > > >> > > > >> For users of Clojure 1.7.0-alpha1, there have been a few important > > > changes > > > >> in transducers since alpha1: > > > >> - Removed flatmap transducer > > > >> - Added cat transducer > > > >> - mapcat 1-arity is now a transducer, specifically: (comp (map f) > cat) > > > >> - The completing function has been lifted to be public > > > >> > > > >> Clojure 1.7.0-alpha2 has the changes below from 1.6.0: > > > >> > > > >> ## 1 New and Improved Features > > > >> > > > >> ### 1.1 Transducers > > > >> > > > >> Transducers is a new way to decouple algorithmic transformations > from > > > >> their > > > >> application in different contexts. Transducers are functions that > > > >> transform > > > >> reducing functions to build up a "recipe" for transformation. > > > >> > > > >> Also see: > > > http://blog.cognitect.com/blog/2014/8/6/transducers-are-coming > > > >> > > > >> Many existing sequence functions now have a new arity (one fewer > > > argument > > > >> than before). This arity will return a transducer that represents > the > > > same > > > >> logic but is independent of lazy sequence processing. Functions > included > > > >> are: > > > >> > > > >> * conj (conjs to []) > > > >> * map > > > >> * mapcat > > > >> * filter > > > >> * remove > > > >> * take > > > >> * take-while > > > >> * drop > > > >> * drop-while > > > >> * cycle > > > >> * take-nth > > > >> * replace > > > >> * partition-by > > > >> * partition-all > > > >> * keep > > > >> * keep-indexed > > > >> > > > >> Additionally some new transducer functions have been added: > > > >> > > > >> * cat - concatenates the contents of each input > > > >> * de-dupe - removes consecutive duplicated values > > > >> * random-sample - returns items from coll with random probability > > > >> > > > >> And this function can be used to make completing transforms: > > > >> > > > >> * completing > > > >> > > > >> There are also several new or modified functions that can be used > to > > > apply > > > >> transducers in different ways: > > > >> > > > >> * sequence - takes a transformation and a coll and produces a lazy > seq > > > >> * transduce - reduce with a transformation (eager) > > > >> * iteration - returns an iterable/seqable/reducible seq of > applications > > > of > > > >> the transducer to items in coll. Applications are re-performed with > > > every > > > >> iterator/seq/reduce. > > > >> * run! - run the transformation for side effects on the collection > > > >> > > > >> There have been a number of internal changes to support > transducers: > > > >> > > > >> * volatiles - there are a new set of functions (volatile!, vswap!, > > > >> vreset!, volatile?) to create and use volatile "boxes" to hold > state in > > > >> stateful transducers. Volatiles are faster than atoms but give up > > > atomicity > > > >> guarantees so should only be used with thread isolation. > > > >> * array iterators - added support for iterators over arrays > > > >> > > > >> Some issues created and addressed during development: > > > >> * [CLJ-1511](http://dev.clojure.org/jira/browse/CLJ-1511) > > > >> * [CLJ-1497](http://dev.clojure.org/jira/browse/CLJ-1497) > > > >> > > > >> ### 1.2 Keyword and Symbol Construction > > > >> > > > >> In response to issues raised in > > > >> [CLJ-1439](http://dev.clojure.org/jira/browse/CLJ-1439), > > > >> several changes have been made in symbol and keyword construction: > > > >> > > > >> 1) The main bottleneck in construction of symbols (which also > occurs > > > >> inside keywords) was > > > >> interning of the name and namespace strings. This interning has > been > > > >> removed, resulting > > > >> in a performance increase. > > > >> > > > >> 2) Keywords are cached and keyword construction includes a cache > check. > > > A > > > >> change was made > > > >> to only clear the cache reference queue when there is a cache miss -- 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 --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.