|
|
|
|
|
by Merovius
2745 days ago
|
|
> It is most certainly not a preference for clarity, though. It is a preference for consistency. FTR, with "most certainly" you're committing the same fault your accusing the Go team here. You might not think it matters for clarity. I, at least, disagree. > in our experience most people can't be trusted to not shoot themselves in the foot. I don't understand the difference between this suggested phrasing and talking about clarity. I'd argue you tend to shoot yourself in the foot if and only if you aren't clear about what you're doing. Clarity and lack of footguns seem directly correlated. |
|
Fair enough. It's too late to edit.
> I don't understand the difference between this suggested phrasing and talking about clarity. I'd argue you tend to shoot yourself in the foot if and only if you aren't clear about what you're doing.
This is partially true but it's not that simple imo.
In my OP, the ternary version is clearer. But if you allow it, then you also open the door to nested ternaries, and foot shooting.
Allowing single line if statements (as, eg, ruby does) also allows for clearer code, at the expense of consistency.