The issue is that a gun system has a maximum range of 2-4km, and when fired while the platform is supersonic, the aircraft can actually hit itself with its own ammunition. A modern BVR AAM, on the other hand, can travel 8 km before its motor runs out of fuel. A WVR AAM can travel at least 4 km before its motor runs out of fuel, and has a NEZ of at least 15 km.
Having a gun port available as a failsafe is a good idea, but dropping the gun isn't such a bad plan.
Having a gun port available as a failsafe is a good idea, but dropping the gun isn't such a bad plan.