Re: [Rd] quote() vs quote(expr=)

2013-02-19 Thread Peter Meilstrup
It probably shouldn't be, but It's possible to bind a value to the missing symbol: x <- environment() eval(substitute(x$y <- "wat", list(y = quote(expr= ls() eval(quote(expr=)) I don't see a way to remove such a binding though. Peter On Tue, Feb 19, 2013 at 5:03 AM, peter dalgaard wrote:

Re: [Rd] quote() vs quote(expr=)

2013-02-19 Thread peter dalgaard
On Feb 18, 2013, at 19:31 , wrote: > I wouldn't count on any way of capturing this thing being reliable in > the long term. As I recall what I do in codetools and the compiler is > use features of missing() to test for it, but try to abstract those > uses into one or two places only so I can

Re: [Rd] quote() vs quote(expr=)

2013-02-18 Thread Hadley Wickham
Ok, that's what I thought. Thanks! Hadley On Mon, Feb 18, 2013 at 12:43 PM, wrote: > Of course not. What I hope can happpen is that we can reduce the > degree to which internal implementation quirks leak out into the user > level. The fact that there is an internal "missing token" (that > happe

Re: [Rd] quote() vs quote(expr=)

2013-02-18 Thread luke-tierney
Of course not. What I hope can happpen is that we can reduce the degree to which internal implementation quirks leak out into the user level. The fact that there is an internal "missing token" (that happens to be used for a couple of different things) is a quirk; if you look at the code I use you

Re: [Rd] quote() vs quote(expr=)

2013-02-18 Thread Hadley Wickham
In general, should we expect that the ability to compute on the language within R will decrease over time? Otherwise, I presume if you do change the behaviour of missing then you'll still provide some way to create/call functions with missing arguments. Hadley On Mon, Feb 18, 2013 at 12:31 PM,

Re: [Rd] quote() vs quote(expr=)

2013-02-18 Thread Hadley Wickham
On Mon, Feb 18, 2013 at 10:35 AM, peter dalgaard wrote: > > On Feb 18, 2013, at 17:04 , Hadley Wickham wrote: > >> quote(expr =) returning missing seems like the right thing to me, >> quote() throwing an error does not, because it violates the usual >> semantics where f(x = ) is equivalent to f().

Re: [Rd] quote() vs quote(expr=)

2013-02-18 Thread luke-tierney
I wouldn't count on any way of capturing this thing being reliable in the long term. As I recall what I do in codetools and the compiler is use features of missing() to test for it, but try to abstract those uses into one or two places only so I can easily change them if missing()'s behavior chan

Re: [Rd] quote() vs quote(expr=)

2013-02-18 Thread peter dalgaard
On Feb 18, 2013, at 17:04 , Hadley Wickham wrote: > quote(expr =) returning missing seems like the right thing to me, > quote() throwing an error does not, because it violates the usual > semantics where f(x = ) is equivalent to f(). Except that it isn't: > (function(...)nargs())() [1] 0 > (fun

Re: [Rd] quote() vs quote(expr=)

2013-02-18 Thread Hadley Wickham
> If there is a bug here, I'd say that it is in str(), revealing the > implementation of the missing value as the symbol ``, Yes, a fix to str would be nice too :) > which we otherwise try not to disclose to R code, e.g. > >> as.symbol("") > Error in as.symbol("") : attempt to use zero-length va

Re: [Rd] quote() vs quote(expr=)

2013-02-18 Thread peter dalgaard
On Feb 18, 2013, at 16:20 , Hadley Wickham wrote: > Hi all, > > I think there's a small buglet in quote: > > str(quote()) > # Error in quote() : 0 arguments passed to 'quote' which requires 1 > str(quote(expr = )) > # symbol > If there is a bug here, I'd say that it is in str(), revealing the

[Rd] quote() vs quote(expr=)

2013-02-18 Thread Hadley Wickham
Hi all, I think there's a small buglet in quote: str(quote()) # Error in quote() : 0 arguments passed to 'quote' which requires 1 str(quote(expr = )) # symbol I bring this up because this seems like the most natural way of capturing the "missing" symbol with pure R code, compared to substitute()