On Feb 18, 2013, at 19:31 , <luke-tier...@uiowa.edu> <luke-tier...@uiowa.edu> 
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 easily change them if
> missing()'s behavior changes. Basically this internal thing
> _shouldn't_ be visible at R level, and if we ever figure out how to
> make that happen it will.
> 
> Best,
> 
> luke
> 

Yes. I think we at some point played around with the idea of making the missing 
object a genuine first class object. However, the semantics are too irregular, 
as in

> a <- alist(x=)
> a$x

> b <- a$x
> c <- b
Error: argument "b" is missing, with no default

An R object than can be referenced, but (sometimes) not dereferenced is just 
weird.

On the other hand, if we want to be able to compute on things like argument 
lists, there needs to be a way of representing an absent default. Also, a 
functions evaluation frame will contain objects representing arguments, even if 
they are missing, as in

> (function(x)ls())()
[1] "x"

So it seems that there is no way around letting lists and environments have 
missing components. It is a quirk that it happens to be implemented as 
as.name(""), though.

Come to think of it, there are a few oddities in the current design: 

- why can't we check for a missing list component with missing(a$x)?

- why does a$x above not throw an error? (I can see that it is necessary to be 
able to shuffle argument lists around, and probably also to subset them, but 
direct dereference could be avoided, I think.)


> On Mon, 18 Feb 2013, 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
>> 
>> I bring this up because this seems like the most natural way of
>> capturing the "missing" symbol with pure R code, compared to
>> substitute() or bquote() or formals(plot)$x
>> 
>> Hadley
>> 
>> 
> 
> -- 
> 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-tier...@uiowa.edu
> Iowa City, IA 52242                 WWW:  http://www.stat.uiowa.edu
> 
> ______________________________________________
> R-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel

-- 
Peter Dalgaard, Professor
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Email: pd....@cbs.dk  Priv: pda...@gmail.com

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to