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

Bill Dunlap bill at insightful.com
Thu Sep 28 17:48:43 CEST 2006


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




More information about the R-devel mailing list