> I'd like to keep #60260 open as a documentation issue and adapt your > explanation into an addition to the Texinfo manual. Is that okay with > you .if/.ie/.el are a matter of recurring confusion.
No problem -- that's why I wrote it. > My first attempt to contrive this situation (attached) did not succeed > in provoking such bad behavior, but I think you have a valid point. It probably doesn't happen very often, because we would have to pop a "true" off the stack for this to be critical, which means that the "if" branch has to be false, but the broken macro still has to be called before the "else" branch. Here is a somewhat contrived situation that exhibits the error: .de My .ie '\\$1'1' my x .el .ie '\\$1'2' my y .el my z .. .de Yr .ie '\\$1'-' [before] .My \\$2 .el [after] .. .Yr - 1 .Yr + 1 which outputs "[before] my x" and "my x my z" (which probably isn't what the code intended). If we correctly write .de My .ie '\\$1'1' my x .el \{.ie '\\$1'2' my y .el my z\} .. we get "[before] my x" and "my x [after]" instead. > [...] since *roff has no C-like "switch" or Lisp-like "cond". Not sure how robust this is, but we can construct something lispish (and even completely braceless): .de cond .if \\n(.$=1 \\$1 .if \\n(.$>1 .cond1 \\$@ .. .de cond1 .ie \\$1 \\$2 .el .cond2 \\$@ .. .de cond2 .shift 2 .cond \\$@ .. .de My .cond '\\$1'a' "CASE 1" '\\$1'b' .special '\\$1'c' "CASE 3" "CASE other" .. .de special .nr x 2+3 CASE special: \\nx .. .My a .My b .My c .My d .My e