Then let courts take stated intent of lawmakers into account and throw out cases where the application of the law is different from the stated intent.
I am not an expert, but I see a problem with this idea too, the lawmaker will need to also write what the intention is, then you can find loopholes in the text of what the intention is. or the intention could be very general so ambiguous to interpret. In some countries there is a way for the people to contest laws as unconstitutional and have judges not politicians decide.
Also why do we think constitutions are perfect, don't countries have to update them periodically to fix them?