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

From: Bill Dunlap <>
Date: Thu 28 Sep 2006 - 15:48:43 GMT

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"

   '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

 "All statements in this message represent the opinions of the author and do  not necessarily reflect Insightful Corporation policy or position." mailing list Received on Fri Sep 29 01:52:00 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Thu 28 Sep 2006 - 17:30:09 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.