the target array is updated @ onbodyentered and @ onbodyexited because that is when the reference to the body is passed to the area and that does not happen every frame that a body is in the area it happens one time when the body enters or exits the area , if it is not accepted then then the turret would have to do a more frame by frame check for overlapping bodies, and that would break more than it would fix the turrets process(delta) begins with "if target" that script does nothing until the detection radius pushes a target into the array @onbody_entered when targets have exited the array is empty and the turret returns home the script becomes inactive , with empty arrays.
some of what you are saying here just does not make sense for the action of autonomous units , if five units of an opposing force are in the detection radius of a unit, the purpose for that information is not limited to targeting , it also at the same time means that five units are targeting it , I don't see how that information is irrelevant if I stand any chance to make some AI for units it is not going to be by discarding information like that.
perhaps you are imagining a player script driven by W, S, A, D keys and an enemy script , but that is not what I have I have a vehicle script and a turret script, that all units share , the player can move units to locations and change target focus , the enemy AI can so far scout and I just got it to select a scouted target and launch its first attack, it would not be able to do that discarding the information you are saying is not relevant.