Just don't do it, surely? (was RE: [R] Retrieve ... argument values)

Simon Fear Simon.Fear at synequanon.com
Wed Sep 17 12:19:50 CEST 2003


There have been various elegant solutions to test for the presence
of a particular named parameter within a ... argument, such as

if (!is.null(list(...)$ylim))
if ("ylim" %in% names(list(...)))

I think I'd have to comment these lines pretty clearly if I wanted
to easily follow the code in 6 months time. 

But I'm still not convinced it is ever a good idea to use this 
technique in preference to using explicit named arguments. If
there is something special about "ylim", why insist that it be 
passed within  "..." in the first place? Surely it's better
to define the function as function(x,ylim=default,...) within which
you do your special ylim stuff, then call plot(x, ylim=ylim,...))??

Can anyone come up with a good reason not to follow
that principle? I think my earlier post may have been
misconstrued: I'm not saying "never write functions that use ...", 
I'm just saying "never write functions that depend on a particular 
argument being passed via ...".
 

Simon Fear
Senior Statistician
Syne qua non Ltd
Tel: +44 (0) 1379 644449
Fax: +44 (0) 1379 644445
email: Simon.Fear at synequanon.com
web: http://www.synequanon.com
 
Number of attachments included with this message: 0
 
This message (and any associated files) is confidential and\...{{dropped}}




More information about the R-help mailing list