Skip to content
Back to formatted view

Raw Message

Message-ID: <alpine.DEB.2.02.1408141406320.2519@luke-Latitude>
Date: 2014-08-14T19:08:30Z
From: Luke Tierney
Subject: `*tmp*`
In-Reply-To: <E643113C-AC37-4CFF-83BF-B4B92191F1B6@oracle.com>

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