[Rd] `*tmp*`

luke-tierney at uiowa.edu luke-tierney at uiowa.edu
Thu Aug 14 21:08:30 CEST 2014

On Thu, 14 Aug 2014, Michael Haupt wrote:

> Hello,
> given that `*tmp*` is removed after a replacement, how can code like this work? Is there some special handling for a variable named `*tmp*` when it comes to make element assignments?
>> x<-c(1,2)
>> x[1]<-42
>> `*tmp*`[1]<-7 # I would expect this one to fail
>> `*tmp*`
> Error: object '*tmp*' not found

This is a consequence of the tricks the interpreter implementation
currently plays to do complex assignments. Compiled code works

> library(compiler)
> cmpfun(function() {
+            x<-c(1,2)
+    x[1]<-42
+    `*tmp*`[1]<-7 # I would expect this one to fail
+ })()
Error in cmpfun(function() { : object '*tmp*' not found


> Confused greetings,
> Michael

Luke Tierney
Chair, Statistics and Actuarial Science
Ralph E. Wareham Professor of Mathematical Sciences
University of Iowa                  Phone:             319-335-3386
Department of Statistics and        Fax:               319-335-3017
    Actuarial Science
241 Schaeffer Hall                  email:   luke-tierney at uiowa.edu
Iowa City, IA 52242                 WWW:  http://www.stat.uiowa.edu

More information about the R-devel mailing list