united-states
Could Congress make it illegal to publish compiled code without corresponding source?
<p>Could Congress pass a law requiring publishers of compiled code to publish source as well, basically codifying the GPL except the permission to use the software (i.e. requiring all software to be source-available)? Could this be enforced against foreign publishers who make their software available in the US?</p>

<h1>This would fall under the Commerce Clause.</h1>
<p>The United States Congress has the power granted to them by the US Constitution to regulate interstate commerce.</p>
<blockquote>
<p>The Congress shall have power</p>
<p>...</p>
<p>To regulate Commerce with foreign Nations, and among the several States, and with the Indian Tribes;</p>
</blockquote>
<p>While this clause has been abused to regulate a wide variety of things that the Founders probably didn't intend it for, regulating the interstate sale of software by requiring the source code of the software also be provided is certainly well within the intended purposes of it.</p>
<p>I think it's unlikely that they <em>would</em> pass such a law, but they have the power to do so if they wanted to. Similarly, the Supreme Court may or may not strike the law down as unconstitutional, but that doesn't stop Congress from passing the law in the first place.</p>

<h2>Sounds like a first amendment violation to me</h2>
<p>A law that compels speech, prima facie violation the first amendment right of freedom of speech. Such a law must survive <a href="https://en.m.wikipedia.org/wiki/Strict_scrutiny" rel="nofollow noreferrer">strict scrutiny</a> by demonstrating a “compelling state interest” - I don’t see one here.</p>
