Law as Computer Code

Cluster debates the analogy between laws and programming code, discussing ambiguities in legal language, the feasibility of encoding laws in code for precision, and the necessity of human interpretation by judges.

📉 Falling 0.4x Legal
3,739
Comments
20
Years Active
5
Top Authors
#4268
Topic ID

Activity Over Time

2007
3
2008
12
2009
63
2010
89
2011
85
2012
163
2013
186
2014
127
2015
188
2016
193
2017
221
2018
236
2019
227
2020
259
2021
366
2022
336
2023
368
2024
355
2025
248
2026
14

Keywords

AI StackOverflow stackexchange.com DAO harvardmagazine.com THAT EU MonteCristo law laws code legal language programming lawyers programming language languages interpret

Sample Comments

terminalcommand Aug 10, 2021 View on HN

The main issue with law is that it is written in an ambiguous language.Theoretically you could write more precise laws with code.Maybe they should have let a group of contract lawyers proofread what the code does. Lawyers look for bugs, inconsistencies, errors, loopholes all the time.

deckar01 Mar 18, 2017 View on HN

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.

vacri Oct 6, 2015 View on HN

"A law" is not like "a line of code".

amelius Mar 24, 2023 View on HN

The law is like a piece of really stinkingly bad code. There's even a StackOverflow for law: https://law.stackexchange.com/ perhaps officials should check it out some time.

Enginerrrd Dec 17, 2024 View on HN

Writing laws to cover complex situations is really not THAT different from writing software. Laws are programs.In that context, does it really seem so absurd that the rules are "obtuse"? Many people feel that way when reading someone else's code, but that doesn't mean all the weird conditionals are unnecessary.

gdhbcc Jul 5, 2019 View on HN

The law should be a programming language. The fact that it's not isn't a feature, it's a bug.

ganzuul Jun 30, 2021 View on HN

Legalese might be similar to code, and there is lots of interest in making law machine readable. So don't give up; check back later.

kdmccormick Sep 18, 2023 View on HN

Legal codes aren't meant to work like programming languages. It is impossible for a legislator to predict how the world will work when their law is applied, and it is highly unlikely that they will anticipate every situation and context in which their law will be invoked.Judges and juries and lawyers all exist to help us interpret the inexact legal code in a way that is (hopefully usually; but obviously not always) fair and reasonable given the often-nuanced situations at hand.

btown Sep 17, 2023 View on HN

Law is like computer code, if:- your compiler was AI-complete and adversarial and hated you- your compiler was also not bound by any hard rules and could emit undefined behavior at any time- your job scheduling and orchestration system was AI-complete and adversarial and actively hated you- your runtime library had 50 different incompatible canonical implementations and can only be run by being forked by publicly-elected officials who blindly merge patches from bad-faith lobby

porknubbins Aug 19, 2024 View on HN

It is very common to naively think laws should be rewritten to be clearer but experience quickly shows why that doesn’t work. Basically laws can only work when they are interpreted by reasonable jurists because the real world is full of grey areas and human language is not clear enough to fully divide the space of “everything that can happen in the world” into clear legal and illegal categories.In programming terms, an appeal’s court deciding an exact number of days police can confiscate prop