groff
[Top][All Lists]
Advanced

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

Re: [Groff] nop request


From: Steve Izma
Subject: Re: [Groff] nop request
Date: Tue, 5 Sep 2000 12:31:45 -0500

> > 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!
> > .  \}
> > .\}
>

> 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.

> ....

> 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

I completely agree with this. I find the structured indentation much easier to 
deal
with (I use python a lot).

I think the .nop request is essentially parallel to the print command in many 
other
scripting languages. It's interesting that troff/gtroff has no ".print" 
command, as
if it would seem redundant relative to the overall purpose of the program; but 
in
this case I think it might be appropriate because we would only use such a 
command
to actually output text strings. Alternatively, I like the idea of ".text" or
".output"


> 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 `."'?

This seems reasonable to me as well.

> 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'.

How would you get the values from the escape function? It would be even more
programmatically useful to have a return request so that:

.de test
.ie '\\$1'1' .return one
.el \{.ie '\\$1'2' .return two
.el .return three
.\}
..
.de something
.ds page \\*[test] \\n%
..

or something like this (I can't quickly think of example from one of the many
instances I've wanted this).

-- 
Steve Izma,                               (519) 884-0710 ext. 6125
    Wilfrid Laurier University Press      FAX: (519) 725-1399
    Waterloo, Ont., Canada N2L 3C5        address@hidden

reply via email to

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