You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When attaching our package, the following text is displayed :
library(inops)
Attaching package: ‘inops’
The following object is masked from ‘package:base’:
<<-
This happens because our package indeed redefines this operator, however no need to worry, it doesn't affect in any way any base or packaged code (these won't ever "see" inops::<<-).
Moreover, if you choose to use <<- in its binary form x <<- y you will not find any difference, this operator has been redefined so the syntax x < y <- value can be supported. Indeed just like class(x) <- value calls the function class<- and x == y <- value calls the function ==<-, calling x < y <- value calls <<-. You can actually try it in a session where inops is not attached :
x<-1y<-2x<y<-3#> Error in x < y <- 3: incorrect number of arguments to "<<-"
inops::`<<-` has an overhead of 4us. This means that if you call it one million time it'll take 8 seconds rather than 4.
Given that this overhead will disappear as soon as you package your function, and that most experienced users will recommend you to stay as far away of this function as possible, we believe worries aren't necessary.
Note that we won't ever try to dissimulate this warning, but might find a way to make it more understandable by all.
The text was updated successfully, but these errors were encountered:
When attaching our package, the following text is displayed :
This happens because our package indeed redefines this operator, however no need to worry, it doesn't affect in any way any base or packaged code (these won't ever "see"
inops::<<-
).Moreover, if you choose to use
<<-
in its binary formx <<- y
you will not find any difference, this operator has been redefined so the syntaxx < y <- value
can be supported. Indeed just likeclass(x) <- value
calls the functionclass<-
andx == y <- value
calls the function==<-
, callingx < y <- value
calls<<-
. You can actually try it in a session where inops is not attached :Created on 2019-11-22 by the reprex package (v0.3.0)
Our package simply implements the 3 parameter usage and leaves the original binary usage unaffected.
Now for those worried about the performance cost, here is a benchmark, where I ran each instruction a million times :
Created on 2019-11-22 by the reprex package (v0.3.0)
inops::`<<-`
has an overhead of 4us. This means that if you call it one million time it'll take 8 seconds rather than 4.Given that this overhead will disappear as soon as you package your function, and that most experienced users will recommend you to stay as far away of this function as possible, we believe worries aren't necessary.
Note that we won't ever try to dissimulate this warning, but might find a way to make it more understandable by all.
The text was updated successfully, but these errors were encountered: