> construct the JPanel outside the atom, add all the listeners and then
> add the panel to structure in the atom.
>
> (let [panel (JPanel. ..)]
> (add-listener-stuff panel the-atom)
> (swap! the-atom assoc :SpiffyPanel panel))
>
> Side-effecting things shouldn't be done inside the swap! since it
Hi,
construct the JPanel outside the atom, add all the listeners and then
add the panel to structure in the atom.
(let [panel (JPanel. ..)]
(add-listener-stuff panel the-atom)
(swap! the-atom assoc :SpiffyPanel panel))
Side-effecting things shouldn't be done inside the swap! since it can
be
Ah, right, this is the function called from swap!. So move the
listener stuff out of your swap function and into the function that
calls swap! instead?
On Thu, Mar 25, 2010 at 11:02 PM, Josh Stratton
wrote:
>> I would just pass the atom and move the @ inside the function...
>
> But the non-atom
> I would just pass the atom and move the @ inside the function...
But the non-atom is automatically dereferenced and sent to the
respective function when I use swap! So unless there's another
function to alter atoms, I'm going to have the dereferenced version
there no matter what, right?
>
> On
I would just pass the atom and move the @ inside the function...
On Thursday, March 25, 2010, strattonbrazil wrote:
> I have a function that I use for adding a JPanel to a ui atom. When I
> call swap! that ui atom is sent to that function I call with the swap!
> on and is dereferenced inside the