4 ms·
But you are OK looking at this?: } } } } }
by tenebrisalietum 3y ago
But you are OK looking at this?:
}
}
}
}
}
- sobellian 3y ago"...if you need more than 3 levels of indentation, you're screwed anyway, and should fix your program."
- alkonaut 3y agoI think he's probably right for C. Unfortunately for TS/JS it's not just idiomatic it's downright unavoidable to have at least twice that number of { } levels.
- sobellian 3y agoBefore async/await I would have agreed with you, but now I think 3 indents is a reasonable maximum (4 if you're writing classes).
- hardware2win 3y ago"If somebody starts talking about stuff like lines count, function sizes, nested ifs depth and tries to define optimal values, then be very careful about their advices" - me, ¤tYear
- sobellian 3y agoRegardless of what you think of this particular maxim, one could do worse than cargo-culting Linus. Code org itself is IMO fairly trivial. I just do whatever I think happens to look good. But trends will emerge even when you're just coding to taste. Thumbing through my code I find very few instances of either `} } } } }` or `)))))` (disclaimer - I don't use lisp).
- alkonaut 3y agoSome times it's unavoidable but I'd try to avoid it if at all possible. There is no perfect syntax. It's common, especially with some newer constructs in TS/JS/C# that you end up with lines saying })), because of a closure passed. And I consider that kind of token salad to be quite a smell too.