On 6/6/06, Lonny Eachus <[EMAIL PROTECTED]> wrote:
Our group has also found that global variables can carry over between separate runs of the same application, probably due to server caching. If a global variable was set during one run of the application, and not explicitly set to something else on the next run, then it would (often? always?) retain the value from the previous run. Whether this behavior is by design or not is moot; it exists and it is something to watch out for.

Lonny, I don't mean any disrespect, but i frankly have a hard time believing this explanation. There is no server caching of global variables.

If you type "ruby foo.rb" to run your tests and then do "ruby bar.rb" to run more tests (or "ruby foo.rb" again) there is no way the global variables from the first run are going to affect the global variables in a later run.

You either are talking about cross-effects between two tests executed in the same ruby session (which is what would be expected to happen) or else some side effects of the first test are persisting (in a cache or something) so that they affect a later run (in which case using globals vs. locals wouldn't make a difference).

If globals really were as unreliable as you report, then Ruby would be a shit language and no one would use it. (Or maybe it would be a magic language and everyone would want to use it?)

I believe that you had a problem and then got rid of the global variables and the problem went away, but i think there must have been something else involved besides that.

Bret
_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general

Reply via email to