5

I've been examining this rather old question and playing around with different functions and classes. As it can be seen below, a single call to setGeneric can result in some notation I've never met before in R.

setGeneric("+", function(e1, e2) standardGeneric("+"),
           useAsDefault=base::`+`)

#Creating a new generic function for ‘+’ in the global environment
#[1] "+"

1 + 1
#`__Deferred_Default_Marker__`

So, what does "__Deferred_Default_Marker__" mean? Is it an "error" or some sort of "undefined behaviour"? FWIW, rm("+") restores the operator and 1 + 1 is again 2.

Community
  • 1
  • 1
tonytonov
  • 25,060
  • 16
  • 82
  • 98
  • 3
    ["You cannot (and never need to) create an explicit generic version of the primitive functions in the base package. ... See the section on Primitive Functions below."](https://stat.ethz.ch/R-manual/R-devel/library/methods/html/setGeneric.html) – Roland Apr 13 '15 at 14:57
  • @Roland Thank you; there's also said "Note that S4 methods can only be set on those primitives which are ‘internal generic’, plus %*%." I knew that I'm doing something forbidden and expected some sort of error or warning, and I'd still like to know what is that "marker" entity. – tonytonov Apr 13 '15 at 15:08
  • I'd suggest to test if this can be reproduced with R-devel and write a feature request. I believe `setGeneric` should give an error in this case. – Roland Apr 13 '15 at 15:15

0 Answers0