[Toybox] [PATCH] nohup: use the same mode constant for open() and xcreate().
enh
enh at google.com
Wed Feb 1 09:02:08 PST 2023
On Tue, Jan 31, 2023 at 9:29 PM Rob Landley <rob at landley.net> wrote:
>
> On 1/31/23 22:57, enh wrote:
> > aye, but only if you're stuck with a compiler from the 1990s... even gcc has
> > warned about that for years :-P
> ...
> > and the warning unless it has parentheses isn't a
> > strong defense either because a&b || c also needs parentheses so they tend to
> > happen...
>
> Thingy.
yeah, but the cure for that readability problem is to use enough
parentheses that it's clear to both human and compiler. (iirc most of
the more modern languages have continued to copy c's mess forward. i
think only Swift has made a serious effort to rationalize operator
precedence? oh, no, golang also appears to have the obvious simplified
"yeah, that's what humans think the precedence should be" precedence.)
> > Otherwise they're theoretically equivalent, so changing it to be the other way
> > because it "looks wrong" otherwise... seems weird to me? It looks like it
> > couldn't be an assignment. That's the point...
>
> I still think wanting comparison to look different from assignment isn't
> inherently weird...
maybe, but this way of doing it is weird (there's a reason it's called
"yoda style" :-) ), and -- at the risk of encouraging you to go and
yoda-ify everything -- it's not like toybox _consistently_ uses this
style (in the same way that "use octal for permissions" is without
doubt the toybox style).
a quick "grep fight" shows a majority of -1 comparisons are the right
way round rather than yoda style. so in addition to the extra
cognitive load of reading something that's backwards, even if you
_only_ read toybox and aren't switching between other projects, even
toybox requires you to switch back and forth.
> Rob
More information about the Toybox
mailing list