groff
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Groff] condition: OR of two string comparisons


From: Carsten Kunze
Subject: Re: [Groff] condition: OR of two string comparisons
Date: Fri, 21 Nov 2014 21:40:09 +0100 (CET)

> Oh, I think a basic .if is still useful to the novice who will probably
> want to conditionally do something, e.g. "DRAFT" heading, etc.  Does mom
> aim to remove the need for any non-mom-macro command, e.g. `.ds company
> Google, Inc.'?

Ok, I agree.  But there might not be much of that statements in a user-only
document, so maybe it is not that important, if for one or two statements
\{\ or { is used.

> > This is an excellent argument against the new syntax.  Both macro
> > syntaxes look totally equal.
> 
> Totally!?

Yes.  (It was unfair to put the .ds after .if !\w and .if d ... :-)
When I compare them again I can't say which one is easier to read.

> You've ignored two of my three points, concentrating only on you are
> trained to be happy with `\{\'.  The improvements aren't aimed at you.
> :-)  My points were
> 
>     Upside... I think the nicer control structures allow indentation
>     that better reflects the logic structure.

Where is the difference here?  You can use the same indentation for
both syntaxes.
(Or do you mean the expression itself?  This would be true.)

>     Whitespace aids grokking
>     expressions.

Are whitespace not already allowed in groff?

>  Insisting on braces and axing the backslases around
>     them, even though it may trample on someone's `.{' macro, lessens
>     clutter.

It's incompatible.  Those who have such a macro would be annoyed.
There can als be string variable called ifx or iff.  So now they need to
change their existing documents?  Well done.

> .} clearly is possible.  Yes, it would break backwards compatibility
> where it has been used as a macro name.  With every change that isn't
> compatible, one must weigh up the pros and cons.  'c'a'b'c'd'e' gives
> little;  it's a special one-off issue with a warty solution.  .} opens
> up a big improvement IMO.

Really? :-)

> > Lets say one would take Werners .if x suggestion.  Then you could
> > write
> > 
> > .if x (...new syntax...) \{\
> > .   nr A x (...new syntax...)
> > 
> > Wouldn't that be sufficient?
> 
> No, because it ignores the else-if benefit to indentation

Could please give an example of this benefit?
I think that

.ie ... \{\
.    ...
.\}
.el .ie \{\
.    ...
.\}

has the same indentation as

if (...) {
    ...
} elsif (...) {
   ...
}

>, and still has
> clutter, adding more for the eXtension.  How would it `x' work for .ds
> rather than .nr?

x would mean "extended numerical expression".  .ds doesn't accept
numerical expressions.

> I guess it, especially a preprocessor, conceivably doesn't have to use
> `.' as its escape character, though I think that would be a mistake.
> Unicode opens up other possibilities;  `·if'.

Would it be a good idea to require nonascii as input encoding for
general requests?

> I'm arguing for control structures and expression syntax that's nicer to
> read and easier to correctly interpret, less error-prone to write, and
> doesn't frighten newcomers off.

The key to new users are the macro packages.  If they are
comfortable there can't be any arguments against the troff language.
Why not have a beautiful macro for conditions or string definition?

Those few who develop macros might not need such radical
language changes.

Carsten



reply via email to

[Prev in Thread] Current Thread [Next in Thread]