Skip to content

How to overload the assignment operator?

1 message · Jens Oehlschlägel

#
Thanks Simon,
"<-" <- function(x, value)UseMethod("<-", value)
DOES dispatch on the second argument (see the dispatchsecond example below)
I AM using the external pointer approach and this works verly well - if one tolerates that the external data is not duplicated when the proxy object is copied. I was wondering however, if it is possible to perfectly mimic R's copying semantics: duplicate external object (and the external pointer) on assignment (or even better only on modify after assignment).

Best regards

Jens Oehlschl?gel
+ UseMethod("dispatchsecond", second)
+ cat("here default\n")
+ }
+ cat("here ff\n")
+ }
here default
here ff
--