Weird bug with dots and parameters that are similar to other arguments

Hi All,

Is the below a bug?? Seems very strange

test <- function(abc = NULL, ...) {
  
  return(list(...))
}

test(a = 1, b = 100)
#> $b
#> [1] 100
test(ab = 1, b = 100)
#> $b
#> [1] 100
test(abc = 1, b = 100)
#> $b
#> [1] 100
test(abcd = 1, b = 100)
#> $abcd
#> [1] 1
#> 
#> $b
#> [1] 100

Created on 2023-12-12 with reprex v2.0.2

It seems to agree wit the partial matching rules I see documented here :

test <- function( abc = NULL, ...) {
  
  return(list(...))
}



pmatch("a",table = c("abc"))
pmatch("b",table = c("abc"))
test(a = 1, b = 100)


pmatch("ab",table = c("abc"))
test(ab = 1, b = 100)

pmatch("abc",table = c("abc"))
test(abc = 1, b = 100)

pmatch("abcd",table = c("abc"))
test(abcd = 1, b = 100)
1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.