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 class which holds a single volatile field). Basically
a volatile box since a field must exist inside a
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 class which
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
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
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
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
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
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!)
--
You
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 not
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
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
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
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)
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
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.
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 mark.engelb...@gmail.com
wrote:
When I explain to new Clojurists what the ! means, I explain that it calls
attention to a mutation function
I just noticed that the ReadableInstant[0] interface is generic, extending
ComparableT [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]
I've also been explaining them the same way as Mark.
On 10 September 2014 17:28, Plínio Balduino pbaldu...@gmail.com 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
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,
Will the videos be uploaded somewhere?
On Tue, Sep 9, 2014 at 5:02 PM, Alex Miller a...@puredanger.com wrote:
*Clojure/conj - Nov 20-22, 2014*
Warner Theater - Washington, DC
http://clojure-conj.org/
Tickets
https://www.eventbrite.com/e/clojureconj-2014-tickets-12388174363: $350
Training
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 al...@puredanger.com
javascript: wrote:
*Clojure/conj - Nov 20-22, 2014*
Warner
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
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
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
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 visibility.
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 brent.mill...@gmail.com
wrote:
I understand usage of volatiles are dangerous via vswap! but what about
creation? Again
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
27 matches
Mail list logo