Once I lived in a state that proposed a very simple anti-child porn law with good intent, but it was too simple. It read sort of like "anyone sending explicit pictures of minors from a cell phone will be guilty of conveying child porn". It was written in the proper legal jargon, but wasn't a whole lot more detailed than that. I called the sponsor of the bill and asked if that meant if my hypothetical daughter sent a naked picture of herself to her boyfriend, then wouldn't she be a felon under his new law? He had an "oh, crap, that's not what I meant!" reaction and ended up withdrawing the bill so it could be re-written. (Aside: I felt pretty good about that. Props to the legislator for being quick to understand and respond appropriately!)
Imagine if that were handled like program code, with a test like:
* This law does not apply to minors sending pictures of themselves.
That would do a few big things:
It would make legislators be clear about what they mean. "Oh, we'd never use this online child safety law to ban pro-trans content from the Internet!" "Great! Let's add that as a test case then." I confess that this is a deal breaker: politicians don't like being pinned down like that.
It would probably make it easier to write laws that reflect those intentions. "Hey, that law as written would apply to a 15 year old sexting her boyfriend! The code doesn't pass the tests."
Future courts could use that to evaluate a law's intent. "The wording says it applies to 15 year olds sending selfies, but the tests are explicit that it wasn't meant to. Not guilty."
I'm sure this couldn't happen for a hundred reasons, but I can dream.