Hi Rolf -- For your consideration:? One of things the R community doesn't emphasise as much as some other (more commercially focussed?) language communities is the importance of automated testing.? Hadley has written that that everything should live in packages which then enables this easily, but, if you, like I, have a project that's a mixed bag of scripts, notebooks, and other gubbins, you then end up fighting the packaging rules.? Notwithstanding, it's relatively easy to do testing without the packaging overhead and this would then solve not only your asterisk duplication problem but also catch a whole host of other problems with programs not working quite the way they were intended it. Just a thought.? Best wishes / Mejores deseos /??Meilleurs v?ux Ian?... On Tuesday, August 26, 2025 at 07:36:11 AM GMT+2, Rolf Turner <rolfturner at posteo.net> wrote: On more than one occasion I have got myself into trouble by fumble-fingering and typing "**" when I intended to type "*". Unfortunately the expression produced is syntactically correct and the consequent incorrect results were difficult (for me) to disentangle. I would be much happier if the "**" operator were simply not allowed, and threw an error.? It seems to me that the existence of the "**" operator is an archaism, probably deriving from Fortran. The documentation, obtained from ?Arithmetic, says at one point:> ** is translated in the parser to ^, but this was undocumented for > many years. It appears as an index entry in Becker et al. (1988), > pointing to the help for Deprecated but is not actually mentioned on > that page. Even though it had been deprecated in S for 20 years, it > was still accepted in R in 2008.It seems still be accepted in R in 2025. Would there be any mileage in asking R Core to deprecate "**", or better still make it defunct?? Can there be any rational basis for keeping "**" around? cheers, Rolf Turner -- Honorary Research Fellow Department of Statistics University of Auckland Stats. Dep't. (secretaries) phone: ? ? ? ? +64-9-373-7599 ext. 89622 Home phone: +64-9-480-4619 ______________________________________________ R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide https://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]]
Speaking of testing and scripts, if you have a problem mistyping * as ** (not a problem I've ever experienced) you might want to add the line fgrep '**' *.R to your own lint script. I'm amused that using '^' for exponentiation is an archaism. Back in the day, some programming languages used an up arrow for that purpose, and the ASCII 63 character set included both a left arrow and an up arrow. If you look at the keyboard of a model 33 Teletype you'll see this on the keyboard. In ASCII 67 the code used for left arrow was changed to underscore and the code for up arrow was changed to caret, which was useful because ASCII 67 specifically let you make accented characters by overstriking. So the handful of languages using "^" do so because that *used* to look like some sort of superscript, although it hasn't for nearly sixty years. And we are cursed with baStudlyCaps runTogetherNames because some long obsolete character sets did not include the underscore. At least "**" has *some* mnemonic value (repeated multiplication). On Tue, 26 Aug 2025 at 19:21, Ian Worthington via R-help <r-help at r-project.org> wrote:> > Hi Rolf -- > For your consideration: One of things the R community doesn't emphasise as much as some other (more commercially focussed?) language communities is the importance of automated testing. Hadley has written that that everything should live in packages which then enables this easily, but, if you, like I, have a project that's a mixed bag of scripts, notebooks, and other gubbins, you then end up fighting the packaging rules. Notwithstanding, it's relatively easy to do testing without the packaging overhead and this would then solve not only your asterisk duplication problem but also catch a whole host of other problems with programs not working quite the way they were intended it. > Just a thought. > > Best wishes / Mejores deseos / Meilleurs v?ux > > Ian ... > > On Tuesday, August 26, 2025 at 07:36:11 AM GMT+2, Rolf Turner <rolfturner at posteo.net> wrote: > > > > On more than one occasion I have got myself into trouble by > fumble-fingering and typing "**" when I intended to type "*". > Unfortunately the expression produced is syntactically correct and the > consequent incorrect results were difficult (for me) to disentangle. > > I would be much happier if the "**" operator were simply not allowed, > and threw an error. It seems to me that the existence of the "**" > operator is an archaism, probably deriving from Fortran. > > The documentation, obtained from ?Arithmetic, says at one point: > > > ** is translated in the parser to ^, but this was undocumented for > > many years. It appears as an index entry in Becker et al. (1988), > > pointing to the help for Deprecated but is not actually mentioned on > > that page. Even though it had been deprecated in S for 20 years, it > > was still accepted in R in 2008. > > It seems still be accepted in R in 2025. > > Would there be any mileage in asking R Core to deprecate "**", or > better still make it defunct? Can there be any rational basis for > keeping "**" around? > > cheers, > > Rolf Turner > > -- > Honorary Research Fellow > Department of Statistics > University of Auckland > Stats. Dep't. (secretaries) phone: > +64-9-373-7599 ext. 89622 > Home phone: +64-9-480-4619 > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide https://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide https://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.
Rolf et al., While removing the ** syntax may fell attractive, removing it will cause legacy program to abend. This is not what one wants from a programming language. It might be better to add code to the parser that produces a wanting message that the ** syntax is not optimal and should be replaced with ^, but which allow legacy programs to run, albeit with a warning message. This will allow old programs to keep running and will prevent Rolf's fumbling finger from fatal flaws. Your toughts? John John David Sorkin M.D., Ph.D. Professor of Medicine, University of Maryland School of Medicine; Associate Director for Biostatistics and Informatics, Baltimore VA Medical Center Geriatrics Research, Education, and Clinical Center; PI Biostatistics and Informatics Core, University of Maryland School of Medicine Claude D. Pepper Older Americans Independence Center; Senior Statistician University of Maryland Center for Vascular Research; Division of Gerontology and Paliative Care, 10 North Greene Street GRECC (BT/18/GR) Baltimore, MD 21201-1524 Cell phone 443-418-5382 ________________________________________ From: R-help <r-help-bounces at r-project.org> on behalf of Ian Worthington via R-help <r-help at r-project.org> Sent: Tuesday, August 26, 2025 3:21 AM To: r-help at r-project.org <r-help at r-project.org>; Rolf Turner <rolfturner at posteo.net> Subject: Re: [R] The "**" exponentiation operator. Hi Rolf -- For your consideration: One of things the R community doesn't emphasise as much as some other (more commercially focussed?) language communities is the importance of automated testing. Hadley has written that that everything should live in packages which then enables this easily, but, if you, like I, have a project that's a mixed bag of scripts, notebooks, and other gubbins, you then end up fighting the packaging rules. Notwithstanding, it's relatively easy to do testing without the packaging overhead and this would then solve not only your asterisk duplication problem but also catch a whole host of other problems with programs not working quite the way they were intended it. Just a thought. Best wishes / Mejores deseos / Meilleurs v?ux Ian ... On Tuesday, August 26, 2025 at 07:36:11 AM GMT+2, Rolf Turner <rolfturner at posteo.net> wrote: On more than one occasion I have got myself into trouble by fumble-fingering and typing "**" when I intended to type "*". Unfortunately the expression produced is syntactically correct and the consequent incorrect results were difficult (for me) to disentangle. I would be much happier if the "**" operator were simply not allowed, and threw an error. It seems to me that the existence of the "**" operator is an archaism, probably deriving from Fortran. The documentation, obtained from ?Arithmetic, says at one point:> ** is translated in the parser to ^, but this was undocumented for > many years. It appears as an index entry in Becker et al. (1988), > pointing to the help for Deprecated but is not actually mentioned on > that page. Even though it had been deprecated in S for 20 years, it > was still accepted in R in 2008.It seems still be accepted in R in 2025. Would there be any mileage in asking R Core to deprecate "**", or better still make it defunct? Can there be any rational basis for keeping "**" around? cheers, Rolf Turner -- Honorary Research Fellow Department of Statistics University of Auckland Stats. Dep't. (secretaries) phone: +64-9-373-7599 ext. 89622 Home phone: +64-9-480-4619 ______________________________________________ R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide https://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] ______________________________________________ R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide https://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
I think it is well past time to terminate this thread. I think the appropriate bottom line is: LET'S NOT MUCK AROUND WITH R SYNTAX ANY MORE (Richard O'Keefe). I.e. "**" should be allowed to continue to act as a synonym for "^". I will just have to live with my propensity for fumble-fingering. Richard O'Keefe also suggested using lint scripts. I will need to learn how to do this. cheers, Rolf Turner -- Honorary Research Fellow Department of Statistics University of Auckland Stats. Dep't. (secretaries) phone: +64-9-373-7599 ext. 89622 Home phone: +64-9-480-4619