RE: https://mamot.fr/@Khrys/116226030767910474

As predicted, humans are being turned into accountability sinks for #AI. AI code doesn’t work? You're fired!

"After outages, Amazon to make senior engineers sign off on AI-assisted changes"

@pluralistic

@elasticsoul @pluralistic Bets that the seniors start not signing off on code they aren't positive really works, with vague comments like "Overly complex, please simplify." or "Insufficient error checking. Please improve."?
@tknarr @elasticsoul @pluralistic
Start with where it puts the curly braces, and tab vs. space indents.
@RealGene @elasticsoul @pluralistic Yes on the first. Using tabs for indentation is an automatic "Fire this person." offense for me. Visual space should always match number of characters.

@jeanmimi @tknarr @elasticsoul @pluralistic

> that is for debate.

Perfect for burning down a rainforest or two with.

@jeanmimi @tknarr @RealGene @elasticsoul @pluralistic (I actually like the exact opposite: exactly one tab per level of indentation, then it's up to the users to set the width of indentations to their liking in their text editors)

@tknarr @RealGene @elasticsoul @pluralistic
Tabs are better for visually impaired individuals. Instead of “SPACE SPACE SPACE SPACE {“ it’s a simple “TAB {“. Learning about that is what made me change my mind about tabs v. spaces.

Realistically at this point, if your editor can’t automatically manage tabs vs spaces, you should get a new code editor.

@spaceinvader @tknarr @RealGene @elasticsoul @pluralistic tabs also allow the reader to adjust the tab width to a level that improves their visual scanning, and adapt to different window/screen sizes. E.g. wide indents when docked to my 43” monitor, narrow indents when the laptop is undocked.

Spaces as indent pushes what works for the author and their specific situation onto all the readers. Optimizing for the wrong use case (code gets read more often than it’s written, and by more people).

@peter @spaceinvader @RealGene @elasticsoul @pluralistic Only when everyone agrees on a specific tab width. If the width changes, then you end up either inserting a tab where you otherwise wouldn't or spaces where a tab would normally be. Think indenting 6 spaces with tab = 8, then reducing to tab = 4. Remember that alignment isn't always to a tab stop, it's often to a specific column. Think aligning a multi-line expression.

@tknarr @spaceinvader @RealGene @elasticsoul @pluralistic not at all. Take a look at “Smart Tabs”. Good editors, like SublimeText support them natively (open issue on VS Code).

You use tabs for indenting (1 per indent level), then switch to spaces if the line is a continuation and you need to align with text on the previous line. You can then change tab width without breaking formatting.

See: https://lea.verou.me/blog/2012/01/why-tabs-are-clearly-superior/

Why tabs are clearly superior • Lea Verou

@tknarr @spaceinvader @RealGene @elasticsoul @pluralistic note this doesn’t work well for aligning comments at the ends of lines, you still need spaces there. Only tabs at the beginning of lines, and only to match the indent level.

Frankly, IMO editors should adopt a real “tab stop” model. After non-whitespace, tabs should skip to align with the tabs on previous lines. The whole “skip to the next even multiple” model was broken from day one.

@peter @spaceinvader @RealGene @elasticsoul @pluralistic Yes. The model was based on the one used on typewriters, but badly adapted ignoring that typewriters had adjustable tabs so stops weren't "next multiple of n columns".
@spaceinvader @tknarr @RealGene @elasticsoul @pluralistic
If your'e going to make the "if your editor can't automatically manage tabs vs spaces" argument, then it applies to the visually impaired editor as well (why would it read out "space space space space" anyway??!?!?)
Also, reminds me of one of my favorite vim commands: ":retab"

@unrtst @spaceinvader @tknarr @elasticsoul @pluralistic

I am deeply, deeply sorry that something I suggested to cause an LLM to short out like Norman The Android in Star Trek has now metastasized.

But shouldn't a screen reader be clever enough to say "four spaces"?

But I guess it would the same as asking how many R's in "strawberry".

@RealGene @unrtst @spaceinvader @elasticsoul @pluralistic It should. Especially if it's being used to handle indentation-heavy stuff like code.
@tknarr I use tabs because I want $number_of_chars = $levels_of_indentation, with easy single-operation increase/decrease of level of indentation.
@developing_agent And when indentation isn't an even multiple of tabs, as when aligning a multi-line expression in an assignment?

@tknarr Because this *isn't* a structural construct (like if/for/etc) I indent up to the level of indentation of that block, then if I *really* need to make things align I fill in the remaining space with spaces. (tabs, if I don't)

This ensures that the block as a whole still indents/unindents correctly with tabs. I am never, ever going to adjust the level of indent of *part* of an expression in this way, so the use of spaces for intra-block expression alignment padding doesn't matter.

@tknarr if this expression by the unholy machinations of mathematics DOES become so gnarly that heavy use of brackets becomes mandatory...

...then I've just invented a new code block surrounded by a different kind of bracket, put the complete expression on a new line inside them, indent with tabs like it's a regular code block, and continue to apply the rules recursively as normal.

@tknarr with \t for tabs and s for spaces:
@tknarr In this example #1 uses a mix of tabs and spaces to get *perfect* alignment, but tbh I mostly just use tabs like #2 until it's close enough. Life is often too short to always get character-perfect alignment on a broken expression that usually contains elements of different sizes anyway.
@developing_agent For me, perfect formatting is just one keyboard shortcut away (or one menu selection). Or less, since my IDE does auto-formatting as I type.
@tknarr I'd rather have code that *is* simple than have bespoke tools which hide the complexity. Using a single type of character everywhere and having a single character per level of indent is considerably easier to think, is more consistently supported across editors, and especially makes scripted metaprogramming easier.
@developing_agent @tknarr Yeah, #1 and #2 are pure chaotic evil though. Tabs *only* to the basic level of indentation, then spaces for alignment is the only way if you're going to use tabs for indentation.
@pdcawley @tknarr I mostly use #2 because life is short and using a single kind of character is simple. I don't bother adding spaces as a whole other kind of character to worry about just to close a 3 character gap.
@pdcawley @tknarr Using spaces at all is usually a special occasion when I'm working with something like a matrix where things *must* be aligned.
@pdcawley @developing_agent Except that, in my experience and that of most devs I've worked with, it never stays just tabs for leading indentation. You get spaces mixed in there for various reasons, and once you do it just gets worse and worse.

@tknarr @pdcawley This is pretty irrelevant.

If I'm writing code for myself, then it's a complete non issue. If I really had to deal with someone adding in spaces randomly, I'd just write a simple linter that turns spaces into tabs. If the rest of the office mandated spaces as a condition of my employment I'd tack on a reverse linter that converts tabs to spaces before I check code in.

@developing_agent @tknarr, that works right up until you change the tab width.
@lp0_on_fire @tknarr use #3, or if you're in an IDE that supports changing tab width then you can always set it to 4.

@developing_agent @tknarr, the point here is that tab width should not matter; I find it reasonable to expect alignment to be maintained within multi-line statements.

Your example, formatted with only tabs for indentation and only spaces alignment. Tab widths are, respectively, 4 and 8.

I may choose to set the tab width to 2. Or 5. Or even 1. (I may do so to see if anything's broken by changing that.) But normally I'll leave it at 8.

(Your option no. 3 is definitely the least bad of the options which you present and is, perhaps, useful; I'd probably choose to replace the last tab with spaces as the purpose looks closer to alignment than to indentation. There is, however, consistency to consider regarding others' code.)

@lp0_on_fire Who says tab width shouldn't matter?

@developing_agent, me, for one. I'll normally use a tab width of 8 but sometimes choose to change it to 4 (or, rarely, 2) for reasons of line length and available screen space (which isn't always the full width of the display). I'll also change it if I need to for specific source code (the editor will detect whether to use spaces or tabs and how many, but it won't detect the tab width).

More generally…

Tab width is exactly why you'll find some people insisting on consistent use of either tabs or spaces for indentation and only spaces for alignment.

It's also exactly why others insist on spaces only, or tabs only and a fixed tab width (which becomes important when you have 80-column limits).

There have been many discussions / arguments / holy wars about tabs versus spaces, and I don't doubt that there will be many more.

@lp0_on_fire for me, the tab with is oh-so-loadbearing for alignment. so tab width stays at 4.

If I need wider spaces? I can use two tabs and it's still 4x fewer characters to wrangle. If line width becomes an issue then there's linebreaking or there's probably a design issue.

@developing_agent That works fine, until someone edits a line with tabs and then spaces, and indents using a tab so now the line has mixed leading tabs/spaces. You can't see them, but as soon as you change tab width those spaces mess things up all over again. I dealt with a codebase that had exactly that, because of the mix of people and editors in use, and it was enough of a nightmare that the entire team agreed to stop work and reformat to spaces-only indentation.
@tknarr One of the reasons I near-universally use tabs for indents everywhere. being within 3 characters of perfectly aligned is good enough.
@developing_agent Ragged indentation, ugh.

@tknarr it really doesn't matter. Most lists of items in expressions aren't of uniform size anyway, so it's a loosing battle trying to align the first elements because none of the others will align. At a certain point you have to ditch purity for getting the job done.

If it becomes a massive multi-line behemoth I reach for #3: https://mastodon.social/@developing_agent/116229171234207326

@tknarr @RealGene @elasticsoul @pluralistic,

/* Indented and aligned for tab width 4, monospace. */
printf("Tabs or spaces?\n"
"Either, so long as it's consistent.\n"
"But only spaces for alignment,\n"
"else you may get misaligned continuations.\n"
"(Go on, adjust the tab width.)\n");

@tknarr @RealGene @elasticsoul @pluralistic Tab key is fine, it just need to insert spaces. Four.
@elasticsoul @pluralistic interestingly, doing this got me fired from a job 7 years ago because management became unsatisfied with the speed of deployments, even though what I was doing was a direct response to massive outages that had legal ramifications. And this was before AI was churning out slop.
@dresstokilt @elasticsoul @pluralistic Where did you find my unwritten autobiography?

@elasticsoul @pluralistic I mean, I kind of agree with this.

You are responsible for the code you commit. If you're using AI, suit yourself, but you are still 100% responsible for the output.

In my experience, unless you burn an absurd amount of tokens, AI is simply not there yet, so I don't use it. It requires 10x the effort to review, and kills your skill development/practice.

This of course presumes that devs have a choice. Fuck companies that force AI use to "boost productivity".