groff
[Top][All Lists]
Advanced

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

Re: [Groff] Question about .substring


From: Steffen Nurpmeso
Subject: Re: [Groff] Question about .substring
Date: Thu, 20 Nov 2014 11:45:04 +0100
User-agent: s-nail v14.7.8-72-gb9e3dff

Hallo,

Ingo Schwarze <address@hidden> wrote:
 |Steffen Nurpmeso wrote on Wed, Nov 19, 2014 at 06:09:08PM +0100:
 |> Ingo Schwarze <address@hidden> wrote:
 |>> Tadziu Hoffmann wrote on Wed, Nov 19, 2014 at 05:20:54PM +0100:
 |>>> Steffen Nurpmeso wrote:
 |>>> [snip]
 |>>>
 |>>> Where do you see a bug?
 |>>> 
 |>>> man 7 groff:

 |>> The wording could be improved.  As it stands, it is not clear

 |>> Maybe:

 |> Inclusive index n2 of the _resulting substring_, please.
 |
 |I don't understand.  Neither what you think is wrong, nor how
 |you suggest to improve it.  It would help to show the complete
 |sentence you are proposing.

You are right and i was wrong.  Completely wrong btw.:

  ?0[]$ printf ".ds x abc\n.substring x 1 0\n.tm \\\\*x\n"|troff -a
  ab

[Thanks Ralph for pointing this out.  You are Pythonic!  'Shall
you want to be that :)]

 |Note that "index n2" is not an index of the resulting substring,
 |but an index of the original string.

Haha!  _Indeed_...

 |> For S-roff i will add a .substr request which takes an index and

 |Please don't.  That is completely equivalent and trivial to convert
 |in either direction, so it merely bloats the user interface for no

Oh yes i will.. starting with a roff macro.

 |gain whatsoever.  In case anybody ever starts using it (hopefully
 |not), you force every other implementation to follow, so everybody
 |loses.
 |
 |While i like some aspects of Perl, lets not adopt the "there's
 |more than one way to do it" abomination into roff.  A concise,
 |consistent user interface is an asset.

While that is true...  The current behaviour is an unusable
mystery to me personally: how can you gain a substring of length
null, for example, and without introducing lengthy calculations on
macro level?  No, to me the above behaviour is too crude to spend
one more second thinking about it!  .substr will take a starting
offset and a length, length null resulting in empty result,
negative lengths i don't like but why not allowing them, meaning
"leave that many characters off the end", which is possibly more
sane than forcing the user to calculate length-offset-X herself.
Ciao,

--steffen



reply via email to

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