Live data from Hacker News

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

news.mit.edu

71–80 of 212 posts

Re: To the brain, reading computer code is not the same as reading language (2020)

#71
I was just thinking today about an idea to introduce some programming constructs to legal documents like contracts and organization policies/procedures. The specific situational semantics inside the documents would still be natural language and meant for human decision makers to implement, but the control flow aspects would be rigidly formalized well enough that documents conforming to this standard could be automatically turned into flow charts. More generally, it would ensure the documents conforming to the standard are able to be "read like a machine" to a certain degree (if not outright machine readable), which has implications for the ability of regulators and judges to "debug"/"trace" situations, or to pro-actively identify "edge cases", or to make tooling which assists with analyzing the documents and related paper trails, irrespective of the particular organization where the matter came from.

So as a follow up to this research, I'm really interested to see, does the brain read legal/formal documents more similar to how it reads code, or more similar to how it reads natural language. Or is it somewhere in between? Does it change when we introduce some syntax constraints on the legal documents? How much rigid syntax does there need to be before the brain switches from one mode to the other?

Re: To the brain, reading computer code is not the same as reading language (2020)

#72
This has been obvious to know who programs and speaks more than one language fluently. There was a government of an anglosaxon country trying to replace a language subject with programming arguing that programming is a language so kids should be able to choose between foreign language or programming

Re: To the brain, reading computer code is not the same as reading language (2020)

#73

"Language" in the context of PL is a misnomer. People even scientist seem to fall into that trap (remember the literate programming movement). PL's are better described as "Specifications". More similar to file format specifications, later converted to executables or interpreted. > the researchers showed them snippets of code and asked them to predict what action the code would produce. That is only (a small) part of…

Programming languages have a syntax, a semantics, and a more or less formal grammar. They have an alphabet, and morphemes in the form of tokens.

They're a notation, yes, but one with a precisely linguistic form. Language is an appropriate word to use here.

Re: To the brain, reading computer code is not the same as reading language (2020)

#74

Not to dismiss the study - I agree that hypotheses require proofs - but, based on my personal experience coding *feels* much more like math, and almost not at all a spoken language, except for the fact that we give identifiable "names" to things (keywords, variables, functions, etc.). Well, not unlike in math in fact. I wonder if the authors (neuroscientists) discussed the premise with programmers and linguists to fo…

It would be interesting to look at programmers with very long (2-4) decades of experience solving programming tasks in different domains. Also, I'd be interested in seeing what happens when they write code for domains entirely new to them vs very familiar.

Re: To the brain, reading computer code is not the same as reading language (2020)

#75
post #58

Earlier quoted context omitted.

Maybe compare to second year students of a very foreign language... (Though I have to say, I'm a self-taught programmer with an academic background in theoretical linguistics as well as university-level experience of several languages quite different to my first language, and this result doesn't not surprise me. There are some obviously analogies to be made at some levels, I think the similarity between human languag…

> I think the similarity between human languages and computer code is frequently overstated It wouldn't even occur to me to think of them as belonging to the same category.

Occasionally you come across languages that do and, at least to me, those languages feel extremely difficult to deal with. For instance, I found AppleScript and HyperTalk to be awful to work with.

I also notice that some junior programmers I've worked with tend to argue for coding styles in mainstream languages that read almost like sentences. Not sure if this is a generational thing or an experience thing.

Re: To the brain, reading computer code is not the same as reading language (2020)

#76
post #6

"Language" in the context of PL is a misnomer. People even scientist seem to fall into that trap (remember the literate programming movement). PL's are better described as "Specifications". More similar to file format specifications, later converted to executables or interpreted. > the researchers showed them snippets of code and asked them to predict what action the code would produce. That is only (a small) part of…

I disagree. Wikipedia's definition [1] is what I had in mind for language: > Language is a structured system of communication that consists of grammar and vocabulary Programming languages are structured, have grammars (often described formally using a grammar definition for some parser generator) and vocabulary (the set of functions and types you can use, possibly modules and package, basically), and they are used to…

It’s more than a coincidental resemblance. Programming languages were designed using constructs from linguistics (context-free grammars, parsers) that were originally developed to describe natural languages.

Re: To the brain, reading computer code is not the same as reading language (2020)

#77

"Language" in the context of PL is a misnomer. People even scientist seem to fall into that trap (remember the literate programming movement). PL's are better described as "Specifications". More similar to file format specifications, later converted to executables or interpreted. > the researchers showed them snippets of code and asked them to predict what action the code would produce. That is only (a small) part of…

I agree - I think it is pretty clear that there is a difference between programming languages and other languages. Figuring out the differences (instead of getting wrong ideas because they share some similarities) should lead to better words for different kinds of languages.

Maybe "Spoken languages" is a better term for languages like English? I find speaking computer code out loud just doesn't work except for some particular lines of code. "At dataclass class QueueItem magnitude colon int equals one..." is really not clear, if I have to communicate such code in words I wouldn't read it directly and instead describe it, e. g. "QueueItem is a dataclass with the attributes...").

Re: To the brain, reading computer code is not the same as reading language (2020)

#78
Not surprising at all, reading code is not like reading prose, not even doing math, is more like a puzzle building in the brain. There's a myriad things to mentally connect and substitute/translate in realtime in order to understand what the code is doing: each function, symbol, variable, statement, abstractions all the way down that makes reading code even more complex than writing it in the first place.

Re: To the brain, reading computer code is not the same as reading language (2020)

#79

"Language" in the context of PL is a misnomer. People even scientist seem to fall into that trap (remember the literate programming movement). PL's are better described as "Specifications". More similar to file format specifications, later converted to executables or interpreted. > the researchers showed them snippets of code and asked them to predict what action the code would produce. That is only (a small) part of…

Yes, obviously there is some conceptual similarity to written language, but the goals are really quite different. Human language is used to communicate, which involves theory of mind and modelling the listener. Programming language is just specifying a computation to be performed.

Still, it's interesting to consider why the "language areas" of the brain apparently are not used for reading or writing computer language (or for other different types of mental activity for that matter).

Some processing areas of the brain are obviously dictated by connectivity and adjacency (visual pathway connects to visual cortex, auditory pathways connect to auditory cortex), but reading of both prose and computer code comes in visually, so why does one get processed by Wernicke's area, and one not?! The best I can guess is that multiple areas of association cortex might be competing to recognize/predict visual inputs, and those areas best equipped to do so will win and perhaps suppress the others.

If this suggestion is true - that via competition the best suited area of brain gets used, then it begs the question what are the key differences, pertinent to the brain, between written prose and computer code that cause this differentiated processing?

Post reply on HN