Re: [ANN] Clojure 1.7.0-alpha2

2014-09-10 Thread Mark Engelberg
I'm curious: how much faster are volatiles than atoms? -- 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 po

Re: [ANN] Clojure 1.7.0-alpha2

2014-09-10 Thread Ashton Kemerling
Perhaps me means dangerous as in it shouldn't be done causually, and that it could become a problematic habit if formed. On Wed, Sep 10, 2014 at 8:55 PM, Brent Millare wrote: > I understand usage of volatiles are dangerous via vswap! but what about > creation? Again relating to what you said,

Re: [ANN] Clojure 1.7.0-alpha2

2014-09-10 Thread Brent Millare
I understand usage of volatiles are dangerous via vswap! but what about creation? Again relating to what you said, 'I asked Rich and he said "making a volatile is as dangerous as any ! op".' On Wednesday, September 10, 2014 10:19:33 AM UTC-4, Alex Miller wrote: > > Usually that's called "visibil

Re: defrecord - CompilerException to referring record defined at other namespace

2014-09-10 Thread Bin Li
Yes , it is. Is it because that / is accessing the 'static' function/field ? so at core.clj: we can only have there constructors as follow ? dt/->Record1 dt/->Record2 dt/map->Record1 dt/map->Record2 On Wednesday, September 10, 2014 10:21:45 PM UTC+8, Alex Miller wrote: > > Is datatypes.clj at

Re: [ANN] Async Ring 0.1.0

2014-09-10 Thread dgrnbrg
Hi Paul, Thanks for your feedback! I updated the comparison with pedestal when discussing the async queues to address this point. I am also really excited about Jet--I think that it would be a great combination with Spiral! One key difference in Spiral from Jet and Pedestal is that not only can

Re: [ANN] Clojure 1.7.0-alpha2

2014-09-10 Thread Alex Miller
On Wednesday, September 10, 2014 11:05:36 AM UTC-5, puzzler wrote: > > When I explain to new Clojurists what the ! means, I explain that it calls > attention to a mutation function that is unsafe to call inside a > transaction. Many programmers coming from Scheme are used to thinking of ! > as

Re: Clojure/conj Speakers and Opportunity Grants

2014-09-10 Thread Alex Miller
Presumably yes, but I don't think that is finalized. On Wednesday, September 10, 2014 2:09:37 PM UTC-5, melipone wrote: > > Will the videos be uploaded somewhere? > > > On Tue, Sep 9, 2014 at 5:02 PM, Alex Miller > wrote: > >> *Clojure/conj - Nov 20-22, 2014* >> Warner Theater - Washington, DC

Re: Clojure/conj Speakers and Opportunity Grants

2014-09-10 Thread myriam abramson
Will the videos be uploaded somewhere? On Tue, Sep 9, 2014 at 5:02 PM, Alex Miller wrote: > *Clojure/conj - Nov 20-22, 2014* > Warner Theater - Washington, DC > http://clojure-conj.org/ > Tickets > : $350 > Training >

Re: Extending clj-time

2014-09-10 Thread Michael Klishin
On 10 September 2014 at 21:11:06, j...@afandian.com (j...@afandian.com) wrote: > I just noticed that the ReadableInstant[0] interface is generic, > extending Comparable [1]. Is it possible to implement a generic > interface with a defrecord? Type parameters in generics do not exist at runtime,

Re: [ANN] Clojure 1.7.0-alpha2

2014-09-10 Thread Daniel Kersten
I've also been explaining them the same way as Mark. On 10 September 2014 17:28, Plínio Balduino wrote: > That's also my explanation about the use of exclamation mark. > > IMHO, +1 for volatile, without !. > > Plínio > > On Wed, Sep 10, 2014 at 1:05 PM, Mark Engelberg > wrote: > >> When I expla

Re: Extending clj-time

2014-09-10 Thread joe
I just noticed that the ReadableInstant[0] interface is generic, extending Comparable [1]. Is it possible to implement a generic interface with a defrecord? [0] http://joda-time.sourceforge.net/apidocs/org/joda/time/ReadableInstant.html [1] http://docs.oracle.com/javase/1.5.0/docs/api/java/lang

Re: [ANN] Clojure 1.7.0-alpha2

2014-09-10 Thread Plínio Balduino
That's also my explanation about the use of exclamation mark. IMHO, +1 for volatile, without !. Plínio On Wed, Sep 10, 2014 at 1:05 PM, Mark Engelberg wrote: > When I explain to new Clojurists what the ! means, I explain that it calls > attention to a mutation function that is unsafe to call i

Re: [ANN] Clojure 1.7.0-alpha2

2014-09-10 Thread Mark Engelberg
When I explain to new Clojurists what the ! means, I explain that it calls attention to a mutation function that is unsafe to call inside a transaction. Many programmers coming from Scheme are used to thinking of ! as meaning *anything* involving mutation, but that's not the case in the Clojure.

[ANN] Strap 0.1.0

2014-09-10 Thread Kelker Ryan
Strap is a faster Clojure project builder https://github.com/runexec/strap $ time strap.js my-project om compojure prismatic/om-tools secretary https://clojars.org/repo/prismatic/om-tools/maven-metadata.xml https://clojars.org/repo/om/om/maven-metadata.xml https://clojars.org/repo/compojure/comp

Re: Extending clj-time

2014-09-10 Thread joe
Thanks. Sorry this is turning into a bit of a brain dump. I've created my record that decorates the original type: (defprotocol IWeirdDate (as-date [this]) (pp [this])) (defrecord WeirdDate [year month day] IWeirdDate (pp [this] (condp = month 21 (str "Spring " year)

Re: [ANN] Clojure 1.7.0-alpha2

2014-09-10 Thread Alex Miller
As an example, if I have: (def a (atom 5)) and execute these from different threads: T1: (swap! a * 2) T2: (swap! a + 2) it depends on timing which update runs first so you can get either 12 (T1 then T2) or 14 (T2 then T1). But it must be one of those results. With a volatile, the reads and w

Re: defrecord - CompilerException to referring record defined at other namespace

2014-09-10 Thread Alex Miller
Is datatypes.clj at src/defrecord_example1/datatypes.clj ? (note _, not - in directory name) On Wednesday, September 10, 2014 6:01:25 AM UTC-5, Bin Li wrote: > > I have records defined at datatypes.clj: > ```clojure > (ns defrecord-example1.datatypes) > > (defrecord Record1 [f1]) > > (defrecord

Re: [ANN] Clojure 1.7.0-alpha2

2014-09-10 Thread Alex Miller
Usually that's called "visibility". Atoms are *not* subject to race conditions if swap! is called from multiple threads (the state of the atom will not change while the update function is being applied). The atom is thus "safe" to be used from multiple threads. Volatiles *are* subject to race

Re: [ANN] Clojure 1.7.0-alpha2

2014-09-10 Thread Brent Millare
When I say synchronization, I specifically mean "writes are guaranteed to be seen by subsequent reads on any thread*" *as Alex said. On Wednesday, September 10, 2014 9:37:09 AM UTC-4, Brent Millare wrote: > > So to summarize, Clojure's volatile provides synchronization across > threads but does

Re: [ANN] Clojure 1.7.0-alpha2

2014-09-10 Thread Brent Millare
So to summarize, Clojure's volatile provides synchronization across threads but does not provide atomaticity with vswap!. So, as a follow up question, then why would the creation of a volatile be "dangerous" but creating an atom isn't? (Hence the exclamation point in the name "volatile!") -- Y

Re: Extending clj-time

2014-09-10 Thread Michael Klishin
On 10 September 2014 at 15:42:01, j...@afandian.com (j...@afandian.com) wrote: > Is this the right way to do this? Yes. > Could I somehow make this implicit > and avoid re-writing the DateTimeProtocol implementations? There's no way around implementing the DateTimeProtocol functions you need

defrecord - CompilerException to referring record defined at other namespace

2014-09-10 Thread Bin Li
I have records defined at datatypes.clj: ```clojure (ns defrecord-example1.datatypes) (defrecord Record1 [f1]) (defrecord Record2 [f1 f2 f3]) ;; this is working at repl (def m-inside1 {Record1 (fn [] ({:a "A"})) Record2 (fn [] ({:n "B"}))}) And using at core.clj : ```clojure (ns defreco

Extending clj-time

2014-09-10 Thread joe
I have a type that's an extended date-time. It can be constructed with the usual year, month, day parameters but (for legacy reasons) the month can be overloaded to mean extra things. E.g. a month of 21 means 'spring', 33 means 'third quarter'. I want to construct this type in a way that it pre

Re: [ANN] Async Ring 0.1.0

2014-09-10 Thread Paul deGrandis
Hi David, It's excellent to see this tools and others like it (eg: Max Penet's Jet - https://github.com/mpenet/jet)! The more ideas we get in this area, the better all the tooling will become. There are a few things I'd like to clear about the notion of asynchronous processing in general and t

[ANN] Jet - Jetty9 wrapper (ring, websocket, http client)

2014-09-10 Thread Max Penet
Jet [1] is a lightweight library for using Jetty9 from clojure. Jetty9 is interesting (compared to 7 or 8) mostly due to the fact that its core has been rewritten to take advantage of Async IO and it brings first class support for WebSocket among other nice things. There's an old'ish post that de

Re: [ANN] Clojure 1.7.0-alpha2

2014-09-10 Thread Softaddicts
I thereby promise to not use my mobile phone ever again to access github :) Luc P. > Oops, I skipped the volatile keyword while reading the code snippet. > Sorry :) > > Luc P. > > > > > No, it means exactly the same thing as volatile in Java (and is implemented > > in the Volatile Java clas