Keeping AdvancedRobot instance in static field
← Thread:Talk:Robocode/Keeping AdvancedRobot instance in static field/reply
I think the risk is that the static robot reference is not guaranteed to be valid after a given round, so if you don’t update the reference things may not work as expected.
Yes, that's also what I guess, and since I'm updating the reference every round, I guess it would not be a problem. However, since robocode did not say what unwanted behavior it is, I'm worrying about more problems: race condition (since each round you have a new thread), GC problem (no longer a problem since robocode cleans static field each battle) and more
Since you're updating it every round, why do you need it to be static?
Ease of access, probably. I was doing the same before my big inversion of control refactoring.
You do not have permission to edit this page, for the following reasons:
- The action you have requested is limited to users in the group: Users.
- You must confirm your email address before editing pages. Please set and validate your email address through your user preferences.
You can view and copy the source of this page.Xor (talk)