Bug 15715

Summary: make call() more flexible
Product: R Reporter: Michael Lawrence <michafla>
Component: LanguageAssignee: R-core <R-core>
Status: NEW ---    
Severity: enhancement    
Priority: P5    
Version: R-devel (trunk)   
Hardware: Other   
OS: Linux   
Attachments: Patch converting call to BUILTIN and adding support for symbols and functions

Description Michael Lawrence 2014-03-15 15:02:46 UTC
Created attachment 1580 [details]
Patch converting call to BUILTIN and adding support for symbols and functions

The attached patch changes call() from a SPECIAL to a BUILTIN and adds support for passing a symbol or function as the 'name' argument. 

The change to a BUILTIN was initially motivated by the (undocumented) lack of support for "...", i.e.,

> fun <- function(...) call("paste", ...)
> fun("a", "b")
Error in fun("a", "b") (from #1) : '...' used in an incorrect context

Combined with the fact that call() was just evaluating its arguments anyway.

Adding support for symbol and function as the name argument just makes sense (well at least for symbols) and avoids the need to refer the user to as.call().