From bill at insightful.com  Thu Sep 28 17:48:43 2006
From: bill at insightful.com (Bill Dunlap)
Date: Thu, 28 Sep 2006 08:48:43 -0700 (PDT)
Subject: [Rd] Warning on backslash sequences (was sprintf behavior)
In-Reply-To: <Pine.LNX.4.64.0609271718410.18168@gannet.stats.ox.ac.uk>
References: <20060925094613.B5FB64C91E@slim.kubism.ku.dk>
	<Pine.GSO.4.56.0609260959290.2640@durian.statsci.com>
	<Pine.LNX.4.64.0609270922370.19951@gannet.stats.ox.ac.uk>
	<Pine.GSO.4.56.0609270750050.3216@durian.statsci.com>
	<Pine.LNX.4.64.0609271718410.18168@gannet.stats.ox.ac.uk>
Message-ID: <Pine.GSO.4.56.0609280803390.4761@durian.statsci.com>

On Thu, 28 Sep 2006, Prof Brian Ripley wrote:

> I don't understand why \` is regarded as intentional.  It crops up in
> packages date and survival (the same code) in
>
>         stop(paste("\`", .Generic, "' not meaningful for dates",
>                     sep = ""))
>
> which clearly should use sQuote(.Generic) in R, but there seems no reason
> to escape in either R or Splus.

The Splus parser uses the same subroutine to parse
both quoted strings and backquoted names, so we added
"\`" to the list of things not to warn about.  E.g.,
we don't want to warn about "\`" in
   `back\`quoted name`
We could warn about it in strings but not in names,
but to be consistent we would also have to warn about
unneeded backslashes in
   "double\'quoted string"
and
   'single\"quoted string'
?  We chose not to bother and don't warn about any
sort of backslash-quote.

> > Splus currently "supports" (does not warn about)
> >    \nnn  (1-3 octal digits)
> >    \n, \t, \b, \r, \', \", and \`
> > We do not support the \f, \v, \xnn, \unnnn, or \Unnnnnnnn.
> > We should add the \f, \v, \a, and \xnn (as well as 0xnn for integers),
> > but we overlooked those.  (Adding new backslash sequences is relatively
> > safe: we have been warning about unrecognized \f's for for years so
> > we shouldn't expect to find too many folks using \f where they intended
> > either \\f or f.)
> >
> > We don't support unicode so we won't do anything with the \unnnn or
> > \Unnnnnnnn.  That is something Splus does need to warn about to aid in
> > porting stuff from R.

----------------------------------------------------------------------------
Bill Dunlap
Insightful Corporation
bill at insightful dot com
360-428-8146

 "All statements in this message represent the opinions of the author and do
 not necessarily reflect Insightful Corporation policy or position."




[Rd] Warning on backslash sequences (was sprintf behavior)
Bill Dunlap