From waku at idi.ntnu.no  Thu Apr  2 11:20:13 2009
From: waku at idi.ntnu.no (waku at idi.ntnu.no)
Date: Thu,  2 Apr 2009 11:20:13 +0200 (CEST)
Subject: [Rd] actual argument matching does not conform to the definition
	(PR#13634)
Message-ID: <20090402092013.1D87E2832190@mail.pubhealth.ku.dk>

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



[Rd] actual argument matching does not conform to the definition (PR#13634)
waku at idi.ntnu.no