Live data from Hacker News

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

news.mit.edu

191–200 of 212 posts

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

#191

This is exactly why I dread the future when people say "oh you will be able to tell the AI what to do, in normal language, and it will do it for you". I do not want to have 8h of "normal" text or speech conversations each and every day. It sounds exhausting. 8h of dealing with programming languages, though, that's fun!

> This is exactly why I dread the future when people say "oh you will be able to tell the AI what to do, in normal language, and it will do it for you"

If it ever comes to that, it should be close to pair programming with AI and it should allow a mix of AI generated and human written code.

Like unsafe in Rust, we should be able to say "I know what I'm doing here, stay out of my way". Then let AI verify human written parts for correctness by means of tests or any other methods.

I think we sort of do this already, but it is the humans who verify the AI generated code and I believe we are a long way from swapping the roles.

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

#192
post #182

Should have used lisp instead, and see all them networks light up like the new years' fireworks.

I'm not sure LISP (which I learned while working (at Boeing Computer Services (which no longer exists))) is a good candidate (for a programming language (that would work like human languages (at least the ones I know))).

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

#193

Earlier quoted context omitted.

You are correct, it's more properly thought of as a specification. However it's a bit more than a misnomer, it's a kind of religion or cult with roots going back decades.

There will be a comeback of literate programming. Tools were not advanced enough for it to be really practical. CS was not mature enough as a field for LP to flourish.

As I noted in a different discussion here:

https://news.ycombinator.com/item?id=40474484

it makes it possible for me to cope with projects which require multiple files or which exceed a certain threshold of lines/complexity.

>With LP, I can quickly look through a PDF, using hyper-linked ToC or index, and control/command click at a point and then have the editor open at that point.

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

#194

You can tell because code has no narrator voice in your head when you read it.

My narrator does tell me the following: 1. Are return values identical for identical arguments? 2. Are there side effects? What are those? 3. "Congratulations, this narrator here found a story that can be told in isolation!" 4. Are the variables used in close locality to their declaration 5. Are all these loops doing what I think they do? (This one requires iterations of temporary code rewrites) 6. Is the story told…

Mine just usually says "wtf?"

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

#196

Earlier quoted context omitted.

There will be a comeback of literate programming. Tools were not advanced enough for it to be really practical. CS was not mature enough as a field for LP to flourish.

As I noted in a different discussion here: https://news.ycombinator.com/item?id=40474484 it makes it possible for me to cope with projects which require multiple files or which exceed a certain threshold of lines/complexity. >With LP, I can quickly look through a PDF, using hyper-linked ToC or index, and control/command click at a point and then have the editor open at that point.

I was not referring to TeX and PDF files. Donald Knuth is the creator of Literate Programming and Tex, but I personally consider this toolchain to belong to the stone age right now.

I was referring to:

1) Org mode and Emacs. LP was introduced as a concept in 1984, and org-mode was created 2007 or close to that. 20+ years later till we finally got a good formatting option for text + code. One can export to PDF or HTML, but i see no reason why not read the code directly in org-mode. It is better actually.

2) A good programming language with types. That's Rust and it was created in 2015.

3) LLM's to automatically generate descriptions of code. Type annotations are one of the most important hints for LLM's to generate accurate descriptions. Untyped or weakly typed code, like, Emacs Lisp, Python etc, does not help LLM's to be as good as possible.

4) A good LLM which is accurate enough, plus cheap enough and fast. That's Llama3-8b on Groq, in which they provide very fast access to Llama3.

I am currently researching how i can take a Rust project 100000 lines, and transform it to a Literate Programming org document. I have created a small program to cut Rust source code to chunks in an intelligent way [1]. Now i am trying to figure out, how to provide structure to the LLM, by extracting type signatures with rustdoc and feed it as context to the LLM with each query.

It will take some months before i have something good, but based on my calculations, an 100000 line program will be transformed to a giant org literate programming document, in an hour, costing close to, 50 cents.

Point being that LP will make a comeback, it's gonna be quick and it's gonna be cheap.

[1]https://github.com/pramatias/documentdf

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

#197

Earlier quoted context omitted.

> “Story” mode is why I like to organize my code top-down, often with definitions appearing after their usages. Yes, it drives me nuts that e.g. Python makes you put the definitions before their use!

well, it is like introducing the characters before they play a role

[deleted]

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

#198

Earlier quoted context omitted.

I’ve never seen a compiler that can answer the question: “what is the purpose of this function?” On the other hand, if I ask a human that question about a particular function and they are unable to answer it satisfactorily, I would have an extremely difficult time believing that they understand it.

Humans don't necessarily run the code step by step in their read to answer this question, either. Quoting again the part that that prompted the discussion: > While the programmers lay in a functional magnetic resonance (fMRI) scanner, the researchers showed them snippets of code and asked them to predict what action the code would produce The question wasn't about whether the programmers understood the code but wheth…

> It also depends on whether the code is a tangled mess or well structured; how descriptive are function names and variable names; whether the code has comments; etc.

Well, it also depends on whether the suspect that the code has a bug.

Normally, we try to understand code by taking shortcuts through function names and structure, and fill the rest of in via pattern matching.

But if I suspect that a piece of code has a bug, I work hard to turn off these higher levels and concentrate on what's actually written.

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

#199

Earlier quoted context omitted.

Perhaps reading code activates the same arras as reading prose in English, but running code in your head activates other areas

If you read code and don't think about what it's doing, are you really "reading" it? Reading code without running it in your head feels like reading prose without actually comprehending it.

You can read code line by line and understand what each line does, but any algorithm that has more than 5 lines of code probably needs an additional step where, after reading it line by line, you need to take a step back and think about it in a different way to understand what the whole block of code is trying to do.

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

#200

This is exactly why I dread the future when people say "oh you will be able to tell the AI what to do, in normal language, and it will do it for you". I do not want to have 8h of "normal" text or speech conversations each and every day. It sounds exhausting. 8h of dealing with programming languages, though, that's fun!

That's why Elon is building Neuralink. Then you can condense the 8hr conversation into 8 minutes of thinking :)
Post reply on HN