I wanted to share something that I just found in debugging a rather lengthy form I am developing. The form has both functions that are called by user actions and watchers. I was having an issue where I was getting inconsistent results in one of the variables. After testing I realized that I inadvertently named a variable the same thing in both a watcher and a named function. I also did not define the variables as local. I'm pointing this out because in all of the other programming I have done variable scope is limited to the function unless explicitly defined.
What I found from my mel trace is about half way through running my function, the watcher ran and changed the variable value. So the moral to the story is define everything as local to avoid this issue -- unless of course you need the value to be seen elsewhere.