MathGroup Archive 2011

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: original meaning of System` functions

  • To: mathgroup at smc.vnet.net
  • Subject: [mg115385] Re: original meaning of System` functions
  • From: Daniel Lichtblau <danl at wolfram.com>
  • Date: Mon, 10 Jan 2011 02:34:14 -0500 (EST)


----- Original Message -----
> From: "hemmecke" <hemmecke at gmail.com>
> To: mathgroup at smc.vnet.net
> Sent: Sunday, January 9, 2011 1:20:06 AM
> Subject: Re: original meaning of System` functions
> If it is impossible to access the original meaning of Mathematica
> System` functions,
> it is also impossible to truely protect implementation details of a
> package.
> 
> Or is there a reliable way to hide the source code of a package?
> 
> Suppose someone has redefined
> 
> Unprotect[SetAttributes]; SetAttributes[_,_]:={}
> Attributes[SetAttributes] = {Protected, Locked}
> 
> before loading the package code. The source code would be available
> just by typing
> 
> ??F
> 
> where F is an exported function of the package.
> 
> Ralf

I am not aware of any foolproof way to hide Mathematica source code. Oddly enough, one of the better ways might be to put all "private" code in a private context. A determined reverse engineer will get to the code, but most people will not want to go through the bother. Of course if it is the determined reverse engineer that is your concern then this will not be adequate.

>From a commercial perspective it might be sufficient to use Encode with a key, so a customer with a valid key would have access to the code. Presumably licensing restrictions would then be needed to keep the code from unlicensed people. Obviously this is still an imperfect scheme, at least where it involves people and/or places for which software licensing is meaningless.

Maybe others in the forum with experience developing Mathematica-based commercial products might have better ideas and/or experience with licensing issues.

Daniel Lichtblau
Wolfram Research


> On 01/06/2011 05:50 PM, Daniel Lichtblau wrote:
> > Ralf Hemmecke wrote:
> >> True, it looks impossible, but maybe there is still a way to get
> >> System`ClearAll in its original Mathematica meaning. I simply want
> >> to
> >> get access to the builtin behaviour of the "function". Possible or
> >> impossible?
> >>
> >> Note, I am not asking for user-defined functions, but rather for
> >> modified system-defined constructs. Deep inside the Mathematica
> >> kernel, the original meaning must have been hardcoded. How to
> >> access
> >> that?
> >>
> >> Ralf
> >
> > I may be misunderstanding the question, but I will mention that many
> > of
> > the System` function DownValues are implemented in C code. So you
> > would
> > not be able to access the actual definitions, if that is what you
> > are
> > seeking.
> >
> > If it is just that you want a way to "restore" those definitions for
> > usage, that might be done within Block but not if you Lock/Protect
> > the
> > new definitions. Or at least not in a way I can see; this is a bit
> > out
> > of my usual area of coding.
> >
> > Daniel
> >
> >
> >> On 01/05/2011 01:12 PM, Leonid Shifrin wrote:
> >>> Hi,
> >>>
> >>> Since you both Protected and Locked these commands, it looks like
> >>> you
> >>> made all the steps to ensure that their definitions can not be
> >>> altered
> >>> in the same session, and thus their original definitions can not
> >>> be
> >>> inspected or used (at least AFAIK). Given the nature of these
> >>> commands,
> >>> I wonder whether this confirmation of impossibility to undo these
> >>> changes was what you were actually after :)
> >>>
> >>> Regards,
> >>> Leonid
> >>>
> >>>
> >>> On Tue, Jan 4, 2011 at 3:51 PM, hemmecke <hemmecke at gmail.com
> >>> <mailto:hemmecke at gmail.com>> wrote:
> >>>
> >>> Is there any way to call the original Mathematica behaviour of a
> >>> function from the System context in case it has previously been
> >>> unprotected and redefined?
> >>>
> >>> For example, how can I access the original meaning of ClearAll
> >>> after
> >>>
> >>> Unprotect[ClearAll,Clear]; ClearAll[__]:=True;Clear[__]:=True;
> >>>
> >>> ?
> >>>
> >>> I just temporarily (i.e. in some safe environment) want to access
> >>> the
> >>> system defined meaning, but actually don't want to undo any
> >>> modified
> >>> behaviour.
> >>>
> >>> Ralf
> >>>
> >>> In[1]:= Unprotect[ClearAll,Clear];
> >>> ClearAll[__]:=True;Clear[__]:=True;
> >>>
> >>> In[2]:= SetAttributes[ClearAll,{Protected, Locked}]
> >>>
> >>> In[3]:= SetAttributes[Clear,{Protected, Locked}]
> >>>
> >>> In[4]:= a[x_]:=x^3
> >>>
> >>> In[5]:= ClearAll[a]
> >>>
> >>> Out[5]= True
> >>>
> >>> In[6]:= ClearAll[ClearAll]
> >>>
> >>> Out[6]= True
> >>>
> >>> In[7]:= System`ClearAll[a]
> >>>
> >>> Out[7]= True
> >>>
> >>> In[8]:= ??a
> >>> Global`a
> >>>
> >>> a[x_] := x^3
> >>>
> >>>
> >>
> >


  • Prev by Date: Re: original meaning of System` functions
  • Next by Date: CUDA: security issues ?
  • Previous by thread: Re: original meaning of System` functions
  • Next by thread: Re: original meaning of System` functions