News for hackers. Stuff that matters.
Re:Cross-platform Rust rewrite of the GNU coreutils by bayindirh on Wednesday January 03, 2024 @09:41AM (#38854575)
When I asked a graybeard why the variable names were so short, he said that "longer names affected compile duration very severely in the past, so this is why we used the shortest name possible".

While user facing programs are not faster by any means, computers got faster in some aspects after all.

Re:Cross-platform Rust rewrite of the GNU coreutils by dboreham on Wednesday January 03, 2024 @11:38AM (#38856120)
This is mostly wrong. Longer variable names never significantly affected the time to run a compiler. Back in the day the run time for compilers was mostly determined by the overhead to load in each overlay (the whole compiler didn't fit in memory). That said, often there was a hard limit on the length of identifiers that wasn't terribly long (e.g. 8 characters), so very verbose names were not possible. The more obvious reasons for preferring short variable names are: 1. It's more like math, and for simple code looks nicer, and the descriptive variable name mafia were still in diapers and 2. typing was slow and painful, so was editing (use an ASR-33 with 'ed' to find out how painful).

What your greybeard might have been talking about was to do with interpreted languages where the interpreter had to parse through the code in some situations when performing a jump/goto. This meant that the more characters there were between the jump origin and destination, the slower execution was. I remember this being a factor in early 8-bit BASIC implementations, leading to a desire to make programs as terse as possible to achieve fast execution. Later implementations tokenized the source before execution, avoiding that problem.

Re:Cross-platform Rust rewrite of the GNU coreutils by bayindirh on Wednesday January 03, 2024 @12:09PM (#38856548)
No, we were talking about how compilers came in at least two disks (one for compiler and one for linker) when this came up.

He started these things with punched cards, and worked at the prominent companies of the time (like IBM and HP), and seen tons of bizarre computer architectures on the way like registerless processors.

He might be recalling a very specific example, or about a very slow system, but I remember the conversation well.

That thing has been probably sorted out by the mid of 90s, but I was just starting programming back then.

Oh, I'm a proud member of "descriptive variable name mafia", but not affiliated with the Java branch. They're a different breed. On the other hand, being written real math in C++ (differential equations), having three letter variable names for everything is equally painful. :)

Re:Cross-platform Rust rewrite of the GNU coreutils by johnisgood on Wednesday January 03, 2024 @11:15AM (#38855779)
I think it is important to strike a balance here, see Java codebases for the other extreme end of the spectrum where the variable name may not fit within 80 column width.
Re:Cross-platform Rust rewrite of the GNU coreutils by bayindirh on Wednesday January 03, 2024 @11:36AM (#38856088)
Of course. I name things as "configuration_storage", but not "configuration_factory_singleton_configuration_stub_constructor". I've been there, seen the horror.

Never again.

Re:Cross-platform Rust rewrite of the GNU coreutils by acchow on Wednesday January 03, 2024 @11:59AM (#38856402)
In 20 years with growing display sizes and resolutions, I’d have hoped 100 or 120 columns replaced 80
Re:Cross-platform Rust rewrite of the GNU coreutils by spencerchubb on Wednesday January 03, 2024 @12:06PM (#38856501)
I thought the column recommendation of 80 was about eye movement and reading speed, not display width.
Re:Cross-platform Rust rewrite of the GNU coreutils by ncallaway on Wednesday January 03, 2024 @12:36PM (#38856912)
I think it was both, and has become more the former now.

My preferred line-width for code would be 80 characters, not including indentation for the line, with a maximum of 120 characters including indentation.

Re:Cross-platform Rust rewrite of the GNU coreutils by lenkite on Friday January 05, 2024 @02:09PM (#38883268)
Apple OS programming beats name length for Java anyday but it never gets a bad rep thanks to apple's reality distortion field.

CMMetadataFormatDescriptionCreateWithMetadataFormatDescriptionAndMetadataSpecifications