634
wait what (pawb.social)
submitted 6 months ago* (last edited 6 months ago) by crimsonpoodle@pawb.social to c/programmer_humor@programming.dev
you are viewing a single comment's thread
view the rest of the comments
[-] vithigar@lemmy.ca 5 points 6 months ago

If I correctly understand what you are saying

You did not, but he also picked an example that could be conflated with the 4-spaces issue.

They're talking about situations where you might want to align text by a number of spaces that isn't divisible by your tab size. I'll expand on their example:

function test(&obj, &obj2, &a) {
$obj->doSomething()
....->doSomethingElse()

$obj2->doSomething()
.....->doSomethingElse()

$a->doSomething()
..->doSomethingElse()
}

Again, dots are "visible spaces" in this example, and being used to align chained methods with the length of the object name.

[-] jadero@programming.dev 4 points 6 months ago* (last edited 6 months ago)

Edit: Bear with me while I sort out the difference between my display and the resulting code block. Ok, close enough.

Ok, thanks. I would instead (and prefer to ) do something like this:

function test(&obj, &obj2, &a) {
$obj---->doSomething()
---->--->doSomethingElse()

$obj2--->doSomething()
---->--->doSomethingElse()

$a-->--->doSomething()
---->--->doSomethingElse()
}

In this case, the ">" are showing the tab stops and the "-" the resulting white space. Note how all the calls are lined up. (My preferred alignment style, not necessarily anyone else's.)

Yet another edit: I see that I missed addressing alignment on other than tab boundaries. To me, that's just sinful! ๐Ÿ˜€

this post was submitted on 28 Feb 2024
634 points (97.2% liked)

Programmer Humor

19165 readers
571 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 1 year ago
MODERATORS