From tlumley at u.washington.edu  Fri Jan 16 19:12:38 2004
From: tlumley at u.washington.edu (Thomas Lumley)
Date: Fri Jan 16 19:11:22 2004
Subject: [Rd] Another wishlist for R 
In-Reply-To: <200401161746.JAA14274@eskimo.com>
References: <200401161746.JAA14274@eskimo.com>
Message-ID: <Pine.A41.4.58.0401160953470.31174@homer04.u.washington.edu>

On Fri, 16 Jan 2004, Kevin Wright wrote:

>
> 10. More uniformity in quoting arguments.
>     Uniformity outweighs cleverness/exceptions ("The Art of Unix Programming").
>     Functions accepting non-quoted arguments
>       is.function(obj)
>       args(predict)
>       rm(a)
>       help(help)
>       find(replace) or find("replace")
>     Functions requiring quoted arguments
>       get("help")
>       exists("predict.lme")
>
>     Some people have claimed "the designers of S knew what they were
>     doing"  because you can do clever things like this:
>         i="help"
>         exists(i)
>     But we could just as easily be doing other clever things
>     and have more uniform quoting rules.  S is probably too mature for this to
>     really be considered.
>

This is actually happening -- gradually these functions are losing the
ability to take both quoted and unquoted arguments. However, it's not a
matter of making them all the same.

is.function() and args() really shouldn't take quoted arguments -- the
argument is an object, not on the name of the object.  This is in contrast
to rm(), help(), and find(), where the argument really is the name of the
object.  One motivation for persuading people to type ?lm instead of
help(lm) is that it might then be possible to force help() to take quoted
arguments.

There's a similar issue with expressions as arguments. A few functions
such as with(), quote(), substitute(), capture.output() correctly take
unquoted expressions as arguments.  Most functions will use only the value
of an unquoted expression.  A number of modelling functions, however, use
unquoted expressions without evaluating them, and shouldn't.  It's
probably too late to stop this for functions like glm(), but at least new
modelling functions could avoid it.  There are notes about this issue at
http://developer.r-project.org/nonstandard-eval.pdf


	-thomas

Thomas Lumley			Assoc. Professor, Biostatistics
tlumley@u.washington.edu	University of Washington, Seattle


[Rd] Another wishlist for R
Thomas Lumley