Hacker News new | ask | show | jobs
by m3ta 3378 days ago
Ethereum tried this, and a bug in the code lead to millions of dollars of value lost. They ended up hard-forking the code by changing it to match the intended outcome of the code, thus reversing the actual outcome of the execution of that code.

Eventually you'll have millions of lines of code, and within those millions of lines of code there will be a bug. It's no different than writing a legal contract in English. In both cases you can only do your best to make sure there is no misunderstanding or undefined behavior, but there is always a possibility that at some point someone will find a flaw and exploit it.

1 comments

On the other hand, you could add tests; i.e. list case examples of outcomes and ensure that the laws meet those tests. That would be particularly helpful in capturing where new laws or changes to laws may create loopholes in other laws. As you say, code can have bugs; test code too; but at least this enforces a more rigorous syntax and saves a fortune in having lawyers debate the meaning of the language used.
Instead of encoding laws in a programming language, they could encode the test cases in a natural language. List a bunch of specific scenarios and be explicit about how the law should be interpreted for them. Every time a judge makes a ruling on an uncovered scenario it gets added to the list. This would take about 90% of the work out of being a lawyer and would make the legal system much more accessible.
Instead of encoding laws in a programming language, they could encode the test cases in a natural language. List a bunch of specific scenarios and be explicit about how the law should be interpreted for them. Every time a judge makes a ruling on an uncovered scenario it gets added to the list.

Isn't that how common law already works?

I think that was the joke, but I'm not 100% sure....
The tests are the lawsuits.
This is how some uniform laws are written. For example, each section of the Uniform Commercial Code (UCC) is followed by commentary, often including example situations. States are encouraged by the UCC committee to incorporate the commentary as part of the official statutes. That makes them binding. Where states choose not to incorporate the commentary, judges usually treat them as strongly persuasive (if non-binding) authority.

The nice thing about the code commentary is that it's easier to append or modify the commentary than a code provision itself. When a provision is changed all the case law is effectively discarded, creating tremendous uncertainty. But changing the commentary is much less likely to break backward compatibility, so to speak.

Of course, the UCC is much more carefully written and reviewed than ad hoc state legislation. The commentary is a little like gilding the lily, relatively speaking.

Testing? With respect to what requirements?