Agreed @WiltingAtTreadmills - but there are usually definitions and careful, accurate wording to assist.
Plus, as far as I am aware, where spirit and letter collide, letter wins. That's why it is so important to draft legislation carefully, and consider.not only every definition, and possible ambiguity/ loophole, but all punctuation, to try to ensure ensure totally clarity.
It isn't the job of the judge to try to read the minds of legislators and they don't like having to do it - they are there to apply the law. That's how some cases end up being appealed so that the high court can give definitive interpretations.
Bad law is a nightmare for judges, I would think - and a money tree for lawyers.
Edited to try to ensure total clarity - it's harder than you think.