The history of the F-4 with no cannon was over 50 years ago when air-to-air missiles weren't reliable, targeting was difficult, and pilot training to use them properly was lacking. I know it's brought up all the time as some great lesson that shouldn't be repeated but one could counter that history has shown the era of the gun for air-to-air combat is indeed dead. Consider:
1. When was the last gun kill by a US pilot? Probably an A-10 versus a helicopter, if you go back further than that things get fuzzy but by some accounts it was an F-8 Crusader during the Vietnam War. Meanwhile the pk has continued to rise as sensors and weapons improve generation to generation.
2. Missiles have improved dramatically since F-4s showed up rocking Sparrows. They don't require constant target illumination, they have much better terminal seekers, two-way data links, much better software algorithms for intercept that use ballistic trajectories, automatic HOJ mode, etc.
3. Missiles do work in close quarters. AIM-9X has lock after launch, can be cued by helmet, high off boresight capabilities, and is almost impossible to spoof because uses imaging infrared so it can tell the difference between a hot airplane and a flare. AAMs produced by other countries also have advanced along similar lines, and many believe with modern AAMs entering the merge is a death sentence for either pilot.
There is nothing wrong with having a gun on a plane, and yes a skilled pilot can still use a cannon to achieve air-to-air kills. However air combat has long been trending towards BVR engagements and missile kills for both BVR and WVR. At some point it becomes a reasonable choice to use your plane's space/weight for something more likely to be used.