From tlumley at u.washington.edu  Thu Apr  2 14:45:11 2009
From: tlumley at u.washington.edu (tlumley at u.washington.edu)
Date: Thu,  2 Apr 2009 14:45:11 +0200 (CEST)
Subject: [Rd] actual argument matching does not conform to the
	definition (PR#13635)
Message-ID: <20090402124511.9028128321A7@mail.pubhealth.ku.dk>


The explanation is that quote() is a primitive function and that the argument matching rules do not apply to primitives.  That section of the R Language definition should say that primitives are excluded;  it is documented in ?.Primitive.

     -thomas


On Thu, 2 Apr 2009 waku at idi.ntnu.no wrote:

> Full_Name: Wacek Kusnierczyk
> Version: 2.10.0 r48269
> OS: Ubuntu 8.04 Linux 32 bit
> Submission from: (NULL) (129.241.199.164)
>
>
> In the following example (and many other cases):
>
>   quote(a=1)
>   # 1
>
> the argument matching is apparently incorrect wrt. the documentation (The R
> Language Definition, v 2.8.1, sec. 4.3.2, p. 23), which specifies the following
> algorithm for argument matching:
>
> 1. Attempt to match named actual arguments to formal arguments exactly.
> 2. For the arguments remaining from step 1, attempt to match named actual
> arguments to formal arguments partially.
> 3. For the arguments remaining from step 1, collectively match all unnamed
> actual arguments to the formal argument '...', if available.
> 4. If any arguments remain, declare an error.
>
> quote(a=1) qualifies for step 4:
>
> 1. The actual argument 'a' does not match exactly quote's only formal argument,
> 'expr'.
> 2. The actual argument 'a' does not match partially quote's only formal
> argument, 'expr'.
> 3. quote has no formal argument '...', hence 'a' remains unmatched.
> 4. An error should be raised.
>
> Instead, the actual argument 'a' is matched to the formal argument 'expr'.  This
> clearly conflicts with the definition.  Either the definition or the
> implementation (or both) are wrong.
>
> The problem is not constrained to quote, and seems to be ubiquitous (though does
> not apply to all functions).
>
> There are additional minor issues with the documentation which were raised in a
> separate thread.
>
> Regards,
> vQ
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

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



[Rd] actual argument matching does not conform to the definition (PR#13635)
tlumley at u.washington.edu