From luke-tierney at uiowa.edu  Thu Aug 14 21:08:30 2014
From: luke-tierney at uiowa.edu (luke-tierney at uiowa.edu)
Date: Thu, 14 Aug 2014 14:08:30 -0500
Subject: [Rd] `*tmp*`
In-Reply-To: <E643113C-AC37-4CFF-83BF-B4B92191F1B6@oracle.com>
References: <E643113C-AC37-4CFF-83BF-B4B92191F1B6@oracle.com>
Message-ID: <alpine.DEB.2.02.1408141406320.2519@luke-Latitude>

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
differently:

> 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

luke

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



[Rd] `*tmp*`
luke-tierney at uiowa.edu