Among, what I believe to be several misconceptions about cause and effect in our history, your idea about having laws passed to protect the programmer's code and how it's used has one major flaw -- defining just what is acceptable use. Am I correct in thinking that you believe the programmer should be an integral part of that definition? It is the current interpretation of law (unless specific otherwise), that the party who paid for the code development has bought the privilege of determining how, what they bought and now own, is to be used. What makes you think your definition, as opposed to anyone else's definition, should be adopted by law so as to determine acceptable use?
If you don't want your code to be used in such applications, then don't work for them. If you feel that code you're asked to write may have applications that you find undesirable, or used that you find for whatever reason to be intolerable, then don't write it. You have that freedom of choice. You may have to find a new job, but that choice is yours, and yours alone to make.
So why do you want to pass a law to take that freedom away? Just because your system of beliefs finds certain applications of technology to unacceptable and/or intolerable, does not mean that every programmer shares that view. There are many programmers who are proud to have their code being used to upgrade weapons systems. That too, is their choice, and neither your choice, nor their choice should be taken away.
Yes, I have been in many countries, and I agree that hatred and violence are quite high. Don't know for sure if the last two years have been more violent in the last 10 years combined, but in any event, there is no shortage of anger in the world today. But I don't agree with you that technology is the cause. Whereas I completely understand that our experiences have been different, and as such, may lead us to different conclusions, my experience has been that the anger is founded in the arrogance and attitude seen in many Americans. Many Americans, in my humble opinion are spoiled, believing that they are better, or that they know better, or can't see beyond their own agenda to recognize that the world, or even their own community, is incredibly diverse and haven't figured out that the diversity, and differences of opinion, are what give humanity and individuals their uniqueness. Rather than recognize and respect that diversity, many only wish to see their own agenda prevail.
Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein