I'm porting my single thread simple mud-like rpg game from scala to
clojure and one thing that is annoying me is the code needed to change
some var.
In scala I do things like that:

val player = new Player(...)

player.str += 1

in clojure I have to do (player is a struct and its attributes are
refs):

(def player (Player ...))

(dosync (ref-set player (assoc player :str (inc (:str player)))))

In scala when I want mutability I just define the variable with "var"
instead of "val", just one letter, simple and elegant.
It's a game, it's full of states and mutability, the game is single
thread, I don't need transactions. Am I missing something?
--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to