[Rd] Is it a good idea or even possible to redefine attach?

Ista Zahn istazahn at gmail.com
Tue Aug 5 21:18:54 CEST 2014


On Tue, Aug 5, 2014 at 2:49 PM, Grant Rettke <gcr at wisdomandwonder.com> wrote:
> Hi,
>
> Today I got curious about whether or not I /could/ remove `attach' from
> my system so:
> - Backed it up
> - Implemented a new one
> - Like this
>
> ,----
> | attach.old <<- attach
> | attach <<- function(...) {stop("NEVER USE ATTACH")}
> `----

Just masking it with your own function, e.g.,

attach <- function(...) {stop("NEVER USE ATTACH")}

should be enough to discourage you from using it.

>
> I got the error:
>
> ,----
> | Error: cannot change value of locked binding for 'attach'
> `----
>
> If I unlock `attach' I assume that I could stomp on it... however is
> that even a good idea?
>
> What will I break?

Anything that uses attach.

>
> My goal was never to allow `attach' in my system, but it was just an
> idea.
>
> Kind regards,
>
> Grant Rettke | ACM, ASA, FSF, IEEE, SIAM
> gcr at wisdomandwonder.com | http://www.wisdomandwonder.com/
> “Wisdom begins in wonder.” --Socrates
> ((λ (x) (x x)) (λ (x) (x x)))
> “Life has become immeasurably better since I have been forced to stop
> taking it seriously.” --Thompson
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel



More information about the R-devel mailing list