Keeping AdvancedRobot instance in static field

Jump to navigation Jump to search

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.

Enamel 32 (talk)15:32, 19 August 2018

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.

Return to Thread:Talk:Robocode/Keeping AdvancedRobot instance in static field/reply (2).

Since you're updating it every round, why do you need it to be static?

Skilgannon (talk)19:38, 20 August 2018

Ease of access, probably. I was doing the same before my big inversion of control refactoring.

Enamel 32 (talk)21:41, 20 August 2018
 

because I’m simply making everything under a static variable, just like lazy singleton. The field itself is not static at all, but the field containing the field is static and has to be static. Diamond uses this style as well afak However the problem of static reference should happen to this style as well, since two approaches are fundamentally equivalent

Xor (talk)03:31, 21 August 2018