git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] diff-cache path restriction fix.

From
IMIngo Molnar <mingo@elte.hu>
Date
May 25, 2005, 09:06 UTC
Message-ID
<20050525090616.GB27025@elte.hu>
In-Reply-To
<Pine.LNX.4.58.0505242002340.2307@ppc970.osdl.org>
* Linus Torvalds <torvalds@osdl.org> wrote:
Show 8 quoted lines
> On Tue, 24 May 2005, Junio C Hamano wrote:
> >
> > LT> Also, what language do you actually speak?
> > 
> > Japanese.
> 
> It is possible it is cultural. I certainly find it harder to read the 
> "unexpected" way.

i'm quite sure it's related to ambiguity. The main problem for the human brain when reading code is ambiguity of expression - ambiguity triggers 'logic' areas of the brain, instead of the 'visual automation' portions of the brain. Like it or not, most of the code reading we do is all automatism, if we had to _think_ about the visual structure of the code we'd be much less effective.

The moment we fall out of automation (you go to the bathroom in the morning but the toothpaste is empty, or you are in the shop and the coffee area got moved to another place), we feel unease. Thinking during normally routine activities means problems, it means distraction, it meant larger reaction times in the jungle for millions of years, and that's why the built-in unease. Thinking generates unease _especially_ if you dont expect it and dont want it - even if you happen to be Albert Einstein or Linus Torvalds ;) [And it's way too easy to let the autopilot drive all the time - there are people who stop thinking in their childhood and autopilot through life.]

Coding styles are mostly there to reduce the syntactic ambiguities of computer languages (and hence reducing parsing complexity), and thus to make it easier for the human brain to parse them - and thus to give more brain capacity for the real thinking.

the other interesting question is, why do most coders pick the 'x < 1' variant? I'm quite sure that's due to most of us having learned coding via operators. It's "x := 1" and "x /= 2", where the mirror image is not valid - and we extend that expectation to ambiguous operators too. It's the more complex entitity (the variable) that we think about first, and then comes the less complex entity. But if someone has a strong math background (Junio?) then the "1 < x < 5" syntax could be the natural thing he got used to.

so as long as the actual expressions are used in an unambiguous way, it's fine and it's part of the coding style and it's all a matter of getting used to it. Junio's method is just as unambiguous. How quickly you can adopt to another coding style is directly related to how practiced you are at it, but it also depends on your fundamental abstraction abilities. The overwhelming majority of coders dont "switch" a coding style that easily, but e.g. people who maintain a large number of packages or use lots of languages are very good at it. You have the luxory to be able to read your own coding style all day so it's pretty natural to feel unease if something else comes along :)

	Ingo
Previous: Junio C HamanoNext: Linus Torvalds
Message 10 of 17 in “diff-cache path restriction fix.”
  1. diff-cache path restriction fix.Junio C Hamano, May 25, 2005
  2. Linus TorvaldsMay 25, 2005
  3. Junio C HamanoMay 25, 2005
  4. Linus TorvaldsMay 25, 2005
  5. Junio C HamanoMay 25, 2005
  6. Russ AllberyMay 25, 2005
  7. Junio C HamanoMay 25, 2005
  8. Linus TorvaldsMay 25, 2005
  9. Junio C HamanoMay 25, 2005
  10. Ingo MolnarMay 25, 2005
  11. Linus TorvaldsMay 25, 2005
  12. Junio C HamanoMay 25, 2005
  13. Thomas GlanzmannMay 25, 2005
  14. Matthias UrlichsMay 25, 2005
  15. [OT] if (4 < number_of_children) you're in troubleJunio C Hamano, May 28, 2005
  16. Ingo MolnarMay 25, 2005
  17. Florian WeimerMay 25, 2005

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.