On Wed, Jan 7, 2009 at 3:13 AM, Tom Ayerst <tom.aye...@gmail.com> wrote:
> Hi Mark,
>
> I think the def inside a defn has to go, it looks like an accident in waiting.

I'm not sure about that. The value last-key-code is only set in the
keyPressed method which is invoked when Swing/AWT detects that the
user pressed a key. It is only used in the snake-with-key-direction
function. After using the value, that function resets it to nil. I
understand the desire to avoid global variables whenever possible. I'd
really like to find a way to get rid of that global variable, but I
haven't been able to. However, in this case I'm having trouble
imagining a scenario where something bad can happen. Can anyone think
of such a scenario? What would be a better way to capture and use the
last key code?

-- 
R. Mark Volkmann
Object Computing, Inc.

--~--~---------~--~----~------------~-------~--~----~
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
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to