URL: <https://savannah.gnu.org/bugs/?68116>
Summary: [troff] explore supporting general use of `!` as
logical operator in numeric expressions
Group: GNU roff
Submitter: gbranden
Submitted: Tue 03 Mar 2026 10:56:57 AM UTC
Category: Core
Severity: 1 - Wish
Item Group: Feature change
Status: None
Privacy: Public
Assigned to: None
Open/Closed: Open
Discussion Lock: Unlocked
Planned Release: None
_______________________________________________________
Follow-up Comments:
-------------------------------------------------------
Date: Tue 03 Mar 2026 10:56:57 AM UTC By: G. Branden Robinson <gbranden>
In comment 1 to bug #68029, I mused:
Another difference is that logical negation in *roff is hamstrung by being
supported only at the beginning of an expression.
C *does* compare favorably to *roff in this respect, and if we could get away
with fixing GNU troff to support `!` as a general logical not operator without
"breaking the world", I'd be thrilled.
This ticket is to pursue exploration of that possibility, and to document what
breaks if one attempts it. And go ahead and implement it anyway if the
breakage doesn't seem too bad.
Presumably something does, or James Clark would have just gone ahead and done
this in 1989-1991.
But in my eight-ish years of educating myself on matters *roffish, I've never
seen any articulation of how such breakage manifests.
So here's my chance to learn something about expression theory. Is that even
a thing?
I observe that bug #68029 proposes killing off GNU _troff_'s support for `==`
as a synonym for `=` in numeric expressions.
But while C hackers will surely wail hideously at that toy being taken away,
the foregoing proposal would hand back to them a more powerful one that they
surely love much more: the old trick of using `!!foo` on an integer-valued
variable `foo` to coerce it to a Boolean. In GNU _troff_, this would even
work on string interpolations, as long as the string contents were already a
valid numeric expression (and desirably parenthesized).
https://stackoverflow.com/questions/11374810/defining-double-exclamation
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?68116>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
signature.asc
Description: PGP signature
