[Rd] sys.call() inside replacement functions incorrectly returns *tmp*

Abs Spurdle @purdle@@ @ending from gm@il@com
Mon Oct 15 02:19:38 CEST 2018


Kia Ora

Let's say we have:
"myreplacementfunction<-" = function (..., value)
{	call = sys.call ()
	print (as.list (call) )
	0
}

Then we call:
x = 0
myreplacementfunction (x, y, z) = 0

It will return:
[[1]]
`myreplacementfunction<-`

[[2]]
`*tmp*`

[[3]]
y

[[4]]
z

$value
<promise: 0x06fb6968>

There's two problems here.
Firstly, x has to be defined otherwise we get an error message.
Secondly, the first argument is returned as *tmp*.

Both are incorrect.

It should be possible to call the function without defining x.
And it should return x rather than *tmp*.
In other words, replacement function calls should be the same as other
function calls.

Although it gets y and z right.


kind regards
Abs



More information about the R-devel mailing list