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

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

From
Linus Torvalds <torvalds@osdl.org>
Date
May 25, 2005, 17:07 UTC
Message-ID
<Pine.LNX.4.58.0505250948340.2307@ppc970.osdl.org>
In-Reply-To
<20050525090616.GB27025@elte.hu>
On Wed, 25 May 2005, Ingo Molnar wrote:
>
> 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.

Absolutely. And you _should_ like it, because it means that you can concentrate on the big problems.

I suspect I react more strongly to some coding style issues than most, exactly because I've been so involved with just one language and one style for so long that I've got more of an auto-pilot than most: normally my brain just coasts past 99% of all code, without having to be very conscious about it at all, exactly because the patterns have become so ingrained.

In contrast, somebody who works on different projects and with many different languages is likely to have many more patterns, but they are probably less deep, so breaking them isn't as disturbing.

>             But if someone has a strong math background (Junio?) then
> the "1 < x < 5" syntax could be the natural thing he got used to.

Actually, even in math (in fact, very _much_ in math) I'd say that people always aim to put the variable on the left side, and you very much tend to try to aim for canonical formats (sort by exponent and variable name). You'd never see anybody write "y + x = 5" or "x + x^2", because there's a canonical format for it, and people use it.

The "1 < x < 5" syntax is very much the odd man out, and that order for the first part is _only_ used for two-sided comparisons afaik. Math people (at least all math texts I've ever seen, and I had math as a strong minor although admittedly that is some time ago) will invariably write the variable on the left side if there's just one comparison.

In fact, in math, I'd expect a person to often tend to take the canonical format even further, and sort _everything_ to the left side, and aim to leave the right side totally empty (ie "0"), exactly because that makes certain combinations much easier. So it wouldn't surprise me at all to see a math person change "x > 1" into "x - 1 > 0", but it _would_ surprise me to see a math person change it into "1 < x" unless it is to combine it with _another_ comparison with "x".

				Linus
Previous: Ingo MolnarNext: Junio C Hamano
Message 11 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.