Re: [racket-users] Testing & global variables

2018-08-08 Thread Kevin Forchione
> On Aug 7, 2018, at 10:56 AM, Alexis King wrote: > > I guess I’ll take the bait and give the obvious-but-unhelpful answer, > “Don’t use global variables.” :) > > I’m joking, but only just barely. It seems difficult to give concrete > advice without knowing more details about your program

Re: [racket-users] Testing & global variables

2018-08-07 Thread Alex Harsanyi
If this is a problem only in your test code, you could write a function to reset/re-initialize the global state, and call that function at the beginning of each test. If you want to have a "global state" for each of the file that requires your module, global variables might not be the right

Re: [racket-users] Testing & global variables

2018-08-07 Thread Kevin Forchione
> On Aug 7, 2018, at 10:56 AM, Alexis King wrote: > > I guess I’ll take the bait and give the obvious-but-unhelpful answer, > “Don’t use global variables.” :) > > I’m joking, but only just barely. It seems difficult to give concrete > advice without knowing more details about your program

Re: [racket-users] Testing & global variables

2018-08-07 Thread Alexis King
I guess I’ll take the bait and give the obvious-but-unhelpful answer, “Don’t use global variables.” :) I’m joking, but only just barely. It seems difficult to give concrete advice without knowing more details about your program and why you felt it was necessary to use global mutable state in the

Re: [racket-users] Testing & global variables

2018-08-07 Thread Kevin Forchione
I’ve got a library that takes maintains global variables. I’d like to be able to test different test files that require this library, but of course if I require those files into a single test file for testing various combinations of data it corrupts the global variables, which are only valid