Live data from Hacker News

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

news.mit.edu

231–232 of 232 posts

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

#231

Earlier quoted context omitted.

Short code may seem unclear, but it does do exactly the same thing as longer code (if written correctly). It's exact opposite of natural language, where short sentences heavily rely on context and supposedly shared knowledge to beget correct understanding. And as such short sentences are prone to misinterpretation. A program can also be seen as an awkward natural language, conveying programmer's intention to other pr…

> short sentences are prone to misinterpretation Exactly. That's why laws or contracts written by lawyers are so verbose. Think of a rent contract or a software license like GPL. Contrast with WTFPL and similar...

Which is why I compared to legalese rather than arbitrary natural-language.

My argument would be that legalese with its strict "May" "Should"s and all that could be sufficiently similar to a (verbose) programming language.

Anecdotally, I certainly have entered "debugging" mode when trying to check if a specific clause of a contract was applicable to my situation before, rather than trying to interpret it liberally.

Of course, anecdote, and only demonstrates that the (my) brain _can_ operate "programmingly" when reading legalese, not that it does so "naturally".

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

#232

Earlier quoted context omitted.

Wow, that's crazy. Others here, and presumably your friends, have talked about how they think of programming "visually", but they don't think visually about conversing in natural language. I thought of a concrete way to describe it: it "feels obvious" to me that any programming language could be "easily" replaced by a systematic diagramming method, with programs translated systematically into equivalent diagrams. If…

I do feel that I could easily translate natural languages into a diagram as well. I am a very visual thinker, but that visual seeps into natural languages as well.

Whoops, missed the comment window on all the replies to me except for this one!

I clearly completely failed to communicate what I meant about "diagramming" a programming language, as evidenced by all the people pointing out that syntax tree diagrams work fine on natural languages, and indeed were originally created for natural languages, which is totally missing the point.

What I meant was that the semantics of programming languages are so limited and constrained that they could easily be translated into an "executable diagram", such as a control-flow graph for imperative code, or a dataflow graph for functional code. The syntax of natural languages is indeed more-or-less similarly constrained as programming languages, but the semantics of natural languages seems completely nebulous and ill-defined to me.

To use the board game analogy from earlier, you could conceivably learn to play chess entirely in terms of chess notation ("1. e4 e5 2. Nf3 Nc6 3. Bb5 a6"), without ever learning about the 8x8 chessboard or the 16 pieces. Chess notation shares no syntactic structure whatsoever with the "syntax"/diagram drawing rules of a chessboard and pieces, yet their semantics are exactly equivalent.

In the same way, the "syntax"/diagram drawing rules of control-flow graphs has no syntactic structure in common with imperative code, yet exactly equivalent semantics. Could you imagine a diagram system that has no syntactic structure in common with natural language, yet completely captures the semantics?

I cannot begin to imagine that. The semantics of natural language defy description.

Post reply on HN