Re: [Rd] (PR#9202) Re: Bugs with partial name matching

From: Thomas Lumley <>
Date: Tue 05 Sep 2006 - 22:54:45 GMT

On Tue, 5 Sep 2006, Thomas Lumley wrote:

> The partial matching is fairly deeply built in to complex assignment,
> because as evalseq works through the nested calls on the LHS the code
> being called doesn't know it is in an assignment call.

The problem in
> D = list(ABCD=2:1)
> D$ABC[]<-3:4
> D

[1] 3 4

[1] 3 4

is that eval.c:evalseq ends up with a reference to D$ABCD from evaluating D$ABC with partial matching. Since evalseq doesn't (and shouldn't) increase NAMED on these partially evaluated calls, NAMED is still 1 for D$ABCD. When evalseq's D$ABC has 3:4 assigned into it the vector is changed directly, since NAMED=1, and both D$ABC and D$ABCD change.

The minimal fix would appear to be the horrible hack of incrementing NAMED whenever a list element is even looked at with partial matching. Otherwise evalseq would have to be taught to recognize aliasing from partial matching.

         -thomas mailing list Received on Wed Sep 06 08:59:16 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Wed 06 Sep 2006 - 11:39:29 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.