groff
[Top][All Lists]
Advanced

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

Re: [Groff] nop request


From: Werner LEMBERG
Subject: Re: [Groff] nop request
Date: Tue, 05 Sep 2000 08:19:18 +0200 (CEST)

> > The .nop is meant as syntactical sugar only.  I believe that code
> > like
> > 
> > .if a \{\
> > .  if b \{\
> > .    nop Hallo!
> > .  \}
> > .\}
> > 
> > is easier to read than
> > 
> > .if a \{\
> > .  if b \{\
> > Hallo!
> > .  \}
> > .\}
>
> Wow, that's a strange belief to hold :-) I look at troff input as
> plain text interspersed with commands so I want Hallo! to be at the
> start of a line so it stands out as plain text and not a command.

Not in macros IMHO.  I prefer to have proper indentation.
Additionally, `.nop' (or whatever name it will finally get) is a
safeguard against spurious whitespace at the beginning of the line.

> > Do you have a better name?
> 
> I've thought hard about this and I don't think so.  Perhaps it is hard
> to name because its purpose doesn't fit well?

It's a philosophical question, I think.  Nobody is forced to use it,
but I believe there are a lot of groff users who will like that.


    Werner


PS: Another `syntactical sugar' idea.  I like to write macros this
way:


.eo

.\" The function `xxx'
.de xxx
  .do-something \$1 \$2 \$3
..

.ec


I strongly believe that you get better code to understand if you can
avoid the doubling of the backslash.  The only minor thing is that, at
top level, `.\"' will then be counted as a macro called `\"' instead
of a comment.  A similar problem exists with `\#'.

My idea is to introduce a `.comment' request to have an equivalent to
the comment escape `\#' -- incidentally, this is exactly your idea of
`.nop' :-) I think that `.nop' isn't a good name for that purpose, but
`.comment' isn't either since it is too long.  What do you think about
using `."'?

Related to this: What about a mechanism to make all escapes available
as a request?  Something like

  .er w'...'        =>      \w'...'
  .er A'...'        =>      \A'...'

`er' stands for `escape request'.

The opposite is already possible (with some limitations) using
`\*[...]'.

reply via email to

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