The solution really is simple - write clearly defined and contained laws or don't write any at all. Most people wouldn't be comfortable with that, though, and in a world where news stories and political debates are forgotten in a matter of weeks people won't find it acceptable if legislators spend months or years writing laws that are easy to understand and don't come with a mountain of edge cases and loopholes.