Re: weird \s

2020-04-02 Thread Bjarni Ingi Gislason
  This has been too much (long) chatter without simple solutions.

"Research is seeing the obvious." [1]

  1) The missing part is information.

  Solution:

  a) Provide a message (warning, error), if "\snn" is in the input.

  b) Augment the documentation to tell the readers,
 that "\snn" is deprecated, obsolete, out of date, etc.

  and what they should use instead.

  2) About the "\snn" problem.

  The current executing code is not the problem.

  The current existing roff-files are not the problem.

  The problem is the people who (still, will) write "\snn"
 instead of "\s(nn" (portability) or "\s[nn]" (for "groff" and
 compatibles).

  "Since breaking out of bad habits, rather than acquiring new
ones, is the toughest part of learning we must expect from that
system permanent mental damage for most students exposed to
it." [2]

  3) Other things.

  a) A missing part of messages is the name of the culprit,
in this case the s-escape (\s).

  Solution: Provide the name ("\\s escape" is already used once in the
subroutine).

  b) Adding details of the argument of the escape in messages is not
necessary.

  c) Adding specific code to report specific syntax errors is not
necessary.

  A look in the documentation should reveal, what the correct, best
syntax is.



Examples:

A) Report bad practice:

  else {
val = val*10 + (c - '0');
error("Use \\s(%1... instead of \\s%1... for more \
robustness.\n\tSee the documentation.", val);
  }
}
val *= sizescale;

B) Add informations to messages

a)
  const char *s_escape_msg = "Previous error message is caused by the \
\\s escape";
  const char *escape = "\\s escape";

b) (a = add, c = changed)
 
  else if (!tok.delimiter(1)) {
aerror("%1", s_escape_msg);
return 0;

if (!get_number(&val, 'z')) {
a  error("%1", s_escape_msg);
  return 0;

  if (start.ch() == '[')
c   error("%1: missing ']'", escape);
  else
c   error("%1: missing closing delimiter", escape);
  return 0;

  else {
cerror("%1: bad digit in point size", escape);
return 0;



[1] 
  The important part of research, which I describe to my
students as "seeing the obvious", and as it has otherwise been
put:

"Scientific research consists in seeing what everyone else has
seen, but thinking what no one else has thought"

-A. Szent-Gyorgyi

Herman Rubin in the Usenet group "misc.education".
#

[2] Page xxxvii in:

On the Cruelty of Really Teaching Computing Science

Edsger W. Dijkstra

SIGCSE Bulletin 1989, 21(1), pp. xxv-xxxix.
Also "www.cs.utexas.edu/users/EWD/"


-- 
Bjarni I. Gislason



Re: weird \s

2020-04-02 Thread Mike Bianchi
Bjarni,
Nice, tight analysis and proposed solutions.  Thank you.
Mike Bianchi

On Thu, Apr 02, 2020 at 11:58:01PM +, Bjarni Ingi Gislason wrote:
 
snip
 
>   1) The missing part is information.
>   Solution:
>  a) Provide a message (warning, error), if "\snn" is in the input.
>  b) Augment the documentation to tell the readers,
> that "\snn" is deprecated, obsolete, out of date, etc.
> and what they should use instead.
> 
>   2) About the "\snn" problem.
>  The current executing code is not the problem.
>  The current existing roff-files are not the problem.
>   The problem is the people who (still, will) write "\snn"
>   instead of "\s(nn" (portability) or "\s[nn]" (for "groff" and
>   compatibles).
 
snip
 
>   3) Other things.
>   a) A missing part of messages is the name of the culprit,
>  in this case the s-escape (\s).
>   Solution: Provide the name ("\\s escape" is already used once in the
> subroutine).
>   b) Adding details of the argument of the escape in messages is not
>  necessary.
>   c) Adding specific code to report specific syntax errors is not
>  necessary.
 
snip
 



Re: weird \s

2020-04-02 Thread Larry McVoy
Agreed.

On Thu, Apr 02, 2020 at 09:11:50PM -0400, Mike Bianchi wrote:
> Bjarni,
>   Nice, tight analysis and proposed solutions.  Thank you.
>   Mike Bianchi
> 
> On Thu, Apr 02, 2020 at 11:58:01PM +, Bjarni Ingi Gislason wrote:
>  
> snip
>  
> >   1) The missing part is information.
> >   Solution:
> >  a) Provide a message (warning, error), if "\snn" is in the input.
> >  b) Augment the documentation to tell the readers,
> > that "\snn" is deprecated, obsolete, out of date, etc.
> > and what they should use instead.
> > 
> >   2) About the "\snn" problem.
> >  The current executing code is not the problem.
> >  The current existing roff-files are not the problem.
> >   The problem is the people who (still, will) write "\snn"
> >   instead of "\s(nn" (portability) or "\s[nn]" (for "groff" and
> >   compatibles).
>  
> snip
>  
> >   3) Other things.
> >   a) A missing part of messages is the name of the culprit,
> >  in this case the s-escape (\s).
> >   Solution: Provide the name ("\\s escape" is already used once in the
> > subroutine).
> >   b) Adding details of the argument of the escape in messages is not
> >  necessary.
> >   c) Adding specific code to report specific syntax errors is not
> >  necessary.
>  
> snip
>  

-- 
---
Larry McVoy  lm at mcvoy.com 
http://www.mcvoy.com/lm 



Re: weird \s

2020-04-02 Thread Doug McIlroy
Amen.

I had a comment drafted and almost ready to go
when Bjarni made it unnecessary.

Doug

Date: Thu, 2 Apr 2020 19:11:35 -0700
From: Larry McVoy 
Agreed.

On Thu, Apr 02, 2020 at 09:11:50PM -0400, Mike Bianchi wrote:
> Bjarni,
>   Nice, tight analysis and proposed solutions.  Thank you.
>   Mike Bianchi
>
> On Thu, Apr 02, 2020 at 11:58:01PM +, Bjarni Ingi Gislason wrote:

snip