From Greg.Snow at imail.org  Wed Oct 12 21:57:44 2011
From: Greg.Snow at imail.org (Greg Snow)
Date: Wed, 12 Oct 2011 13:57:44 -0600
Subject: [Rd] how to make a true binary package?
In-Reply-To: <1318352963569-3895262.post@n4.nabble.com>
References: <1318350794267-3895117.post@n4.nabble.com>
	<4E947232.70301@gmail.com> <1318352963569-3895262.post@n4.nabble.com>
Message-ID: <B37C0A15B8FB3C468B5BC7EBC7DA14CC6356C2E83A@LP-EXMBVS10.CO.IHC.COM>

If you want to hide some code from accidental or casual sight then I have had some success with adding something like this to the .R file for a package (the petals function in TeachingDemos in this case):

.onAttach <- function(...) {
    petals <- petals
    attr(petals,'source') <- "Don't Cheat!"
    assign('petals',petals,'package:TeachingDemos')
}

Though that would only slow an experienced R programmer down by maybe 10 seconds if they really wanted to see the code, it might take an intermediate level R programmer a whole minute to figure out how to work around this.  But it would prevent an honest user that knew of a license or agreement to not look at the code from accidentally seeing what they agreed not to.

You could also include something in the code that checked the attribute and stopped working if it was changed or somehow notified you of the change.  Combining this with the license agreements as others have said might give you additional recourse.

You can see the petals.R file in the TeachingDemos package on R-forge for another example of obfuscating (bleaching) a key piece of code.  Combining the 2 might slow down an expert by a whole 30 seconds, but at least they would not be able to claim that they accidentally saw the code.

Whether this violates the spirit of R licensing or not is another issue.

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow at imail.org
801.408.8111


> -----Original Message-----
> From: r-devel-bounces at r-project.org [mailto:r-devel-bounces at r-
> project.org] On Behalf Of A Zege
> Sent: Tuesday, October 11, 2011 11:09 AM
> To: r-devel at r-project.org
> Subject: Re: [Rd] how to make a true binary package?
> 
> OK, gentlemen, i agree with you in general. I was not talking about a
> general
> purpose, general use package that one prepares for CRAN. I am sure you
> are
> familiar professionally or can imagine situations where you need to
> demonstrate a solution to a specific task without fully disclosing the
> details -- sometimes even hard core open source adherents need to
> sacrifice
> desire for openness for some prosaic purposes, like getting paid :).
> Compilable languages give an easy solution of a binary code. It sounds
> like
> if one wants true binary, he has to recode in C++. I thought it's
> possible
> in R as well, i thought this was discussed even as a default behavior
> for
> next version of R to make stuff go faster. Maybe not. Thanks, anyway.
> 
> 
> --
> View this message in context: http://r.789695.n4.nabble.com/how-to-
> make-a-true-binary-package-tp3895117p3895262.html
> Sent from the R devel mailing list archive at Nabble.com.
> 
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel



[Rd] how to make a true binary package?
Greg Snow