Re: [Rd] WISH: eval() to preserve the "visibility" (now value is always visible)

2015-02-10 Thread Henrik Bengtsson
On Sun, Feb 8, 2015 at 8:44 PM, Suharto Anggono Suharto Anggono via R-devel wrote: > Sorry to intervene. No, I'm very happy you intervened. You're comment is 100% valid/correct making my wish moot. Your explanation is very clear and nails it; one should use eval(substitute(expr)) or evalq(expr)

Re: [Rd] WISH: eval() to preserve the "visibility" (now value is always visible)

2015-02-08 Thread Suharto Anggono Suharto Anggono via R-devel
Sorry to intervene. Argument passed to 'eval' is evaluated first. So, eval(x <- 2) is effectively like { x <- 2; eval(2) } , which is effectively { x <- 2; 2 } . The result is visible. eval(expression(x <- 2)) or eval(quote(x <- 2)) or evalq(x <- 2) gives the same effect as x <- 2 . The result is

Re: [Rd] WISH: eval() to preserve the "visibility" (now value is always visible)

2015-02-07 Thread Duncan Murdoch
On 07/02/2015 12:40 PM, Henrik Bengtsson wrote: > Would it be possible to have the value of eval() preserve the > "visibility" of the value of the expression? > > > "PROBLEM": > > # Invisible >> x <- 1 > > # Visible >> eval(x <- 2) > [1] 2 > > > "TROUBLESHOOTING": >> withVisible(x <- 1) > $va

[Rd] WISH: eval() to preserve the "visibility" (now value is always visible)

2015-02-07 Thread Henrik Bengtsson
Would it be possible to have the value of eval() preserve the "visibility" of the value of the expression? "PROBLEM": # Invisible > x <- 1 # Visible > eval(x <- 2) [1] 2 "TROUBLESHOOTING": > withVisible(x <- 1) $value [1] 1 $visible [1] FALSE > withVisible(eval(x <- 2)) $value [1] 2 $visible