Most beginners in programming eventually end up with the same ingratiating message: „Programming is easy, everyone can do it”, with some threatening message that people doing the gatekeeping should stop doing that. I’m here to tell you that that is not true. Programming is hard, programming is not for everyone, and for the time being everyone might be able to do it, but most definitely most should not. Like most of the empty, shallow, positive messages coming with an automatic defense against refute, in this case talking about this gatekeeping thing that simply doesn’t happen.
I think gatekeeping is definitely a thing that happens. I should know, I used to hold the opinion that not everybody can be a programmer, because there are non-trivial skill sets that are necessary, such as attention to detail, ability to analyze and reason out possible outcomes, the ability to imagine abstractions in your head, and so on. Back when I did training for new hires, I could easily tell who are the people who wouldn’t pass, by simply noting who had trouble with things like SQL joins. (This was back in the day when we expected our devs to be able to handle everything from backend database stuff to web frontends with HTML/CSS/JS. I assume modern day frontend devs wouldn’t have much use for SQL usage…)
That being said, it’s not a hard gate, where someone can tell you it’s impossible to become a programmer. Anyone can be a programmer, in the same way that anyone can become an accountant or a lawyer or such: it’s going to take a nontrivial amount of effort and hard work (I’m not claiming that being a programmer is necessarily as difficult as those jobs!). Some people may make it look easy, because they may have a bit more aptitude than others (due to background or whatever), in the same way that some people find math easy and others find it nearly impossible. And a lot of the time it’s impossible to detect whether that aptitude exists until you’re trying it out.
There’s also a huge difference between learning to code just to write a few scripts in Python or some macros in Excel vs working professionally as a programmer, possibly in a team, with serious deadlines and crunch and all that. Not everyone is suited to that life.
I’m all for inclusivity - we definitely need more people working in tech, and for people who are struggling, learning to code may be a way for them to live better lives. But we shouldn’t sugarcoat the challenges involved or the effort required. “Anyone can learn to code”, given enough time and effort, but that doesn’t mean programming is easy.