r/programming • • Dec 16 '20

To the brain, reading computer code is not the same as reading language

https://news.mit.edu/2020/brain-reading-computer-code-1215
4.4k Upvotes

546 comments sorted by

View all comments

Show parent comments

316

u/[deleted] Dec 16 '20

I guess code has a very rigid formal grammar, while language leaves a lot of room for interpretation. Maybe that's one difference.

93

u/r0ck0 Dec 16 '20

I really wish stuff like legal contracts + tax guidelines etc used more brackets like in maths, e.g:

  • You must do (A) or (B and C)

...instead contracts etc are still way too focused on reading like regular paragraphs, and we get more ambiguous stuff like:

  • You must do A or B and C

I really don't get why they can't use more brackets for this kind of stuff.

Pretty much everyone (who would be expected to be able to read legal contracts etc) knows that's how they work in maths, it doesn't require programming knowledge. And even those who might not be used to the brackets will catch on pretty quickly.

I can't see any downside to making things clearer like this. Just seems to be another thing where nobody wants to break conventions, and everyone loses.

34

u/[deleted] Dec 16 '20 edited Dec 16 '20

You must do A or B and C

You can write that as:

You must do [one of]:

  • A or

  • B and C

and it's clear.

10

u/Angrydie-a-ria Dec 16 '20

What if it’s interpreted as you must do:

One of: A or B

And also C

So A and C or B and C

Instead of A and B or A and C as is described in your post

I can see how that’s kind of iffy on the interpretation side

17

u/[deleted] Dec 16 '20

I've seen my fair share of long ass business contracts and I've never seen anything like this, but my inclination would be to say you write that as:

You must do A or B. Additionally, you must do C.

Like, there's no reason to over complicate this stuff and most of the time contracts are complicated in terms of how their laid out, a lot of the complication comes from the specific meanings terms can have in legal documents.

7

u/darkon Dec 16 '20

I tried reading 3 U.S. Code § 15 last night, aka the 1887 electoral count act. It's one of the most poorly-written things I've ever seen. Mark Twain once complained that reporters would write "a raging inferno consumed the edifice" instead of simply "the house burned down", but even accounting for that tendency it's horrible.

→ More replies (6)
→ More replies (3)
→ More replies (2)

9

u/87_percentrum Dec 16 '20

It's kinda ridiculous how we have created all of these fantastic tools to manage all aspects of such a complex thing like programming such as version control, change logs, detailed documentation including use cases, known bugs, TODO, IDE's with code completion and linters etc. and nobody has incorporated any of them into something that seems equally as complex like law.

Imagine a lawhub! Or LawStorm with a realestate law extension for your region!

Feels like this should be a thing by now...

→ More replies (2)

8

u/ptoki Dec 16 '20

I like your point.

I also wish that law was either more down to earth with explanation what is the idea behind it or more rigid in a way code is.

The current way the law is formulated is not strict enough but also does not contain clear message (even if not really precise).

Disclaimer: some regulations are actually pretty well formulated. But unfortunately not everything.

→ More replies (1)
→ More replies (13)

329

u/CoffeeTableEspresso Dec 16 '20

My code is very sloppy so maybe it's the same for me

600

u/YoMommaJokeBot Dec 16 '20

Not as sloppy as ur mum


I am a bot. Downvote to remove. PM me if there's anything for me to know!

188

u/CoffeeTableEspresso Dec 16 '20

I walked right into that one....

10

u/sebwas Dec 16 '20

Walked in on your mom being sloppy?

84

u/Phoenix_King69 Dec 16 '20

The robot uprising circa 2020 colorized

32

u/frafdo11 Dec 16 '20

They’re better at cracking jokes than most comedians. Kevin Hart should take notes

109

u/[deleted] Dec 16 '20

good bot

7

u/PandaMoniumHUN Dec 16 '20

Beautiful thing about it is you can't even get mad at the damn thing, it's just doing it's job. :)

14

u/[deleted] Dec 16 '20

Good bot

11

u/righteousprovidence Dec 16 '20

Damn son, chill

5

u/armhad Dec 16 '20

Damn, what a great way to start my morning

9

u/yanitrix Dec 16 '20

lol for a second I thought I was on r/ethoslab

→ More replies (3)

4

u/spore_777_mexen Dec 16 '20

But you follow the rules for the code to run.

→ More replies (1)

7

u/Francois-C Dec 16 '20

I guess code has a very rigid formal grammar

Agreed. Also it doesn't allow polysemy at all, neither irony or sarcasm that would need a judgment from the compiler or interpreter.

As a French-speaking (bad) amateur programmer and (decent) Latinist, I always felt like writing in Latin, a language that has not the same structures as modern ones, was closer to programming, because it makes me make a detour in my thinking, identify precisely the reality to be translated, then transpose it into a system of signs that works differently.

But programming is also like building an automated machine.

10

u/[deleted] Dec 16 '20

(decent) Latinist,

Salve, video ego tu quoque es vir culturae.

→ More replies (11)
→ More replies (3)

5

u/saracuratsiprost Dec 16 '20

Grammar? How about semantics? Rigidity of computer language semantics vs human language semantics is constant vs inf.

→ More replies (12)