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: [mg115475] Re: original meaning of System` functions
  • From: hemmecke <hemmecke at gmail.com>
  • Date: Tue, 11 Jan 2011 19:24:40 -0500 (EST)
  • References: <igecsk$csc$1@smc.vnet.net>

On Jan 10, 8:35 am, Bill Rowe <readn... at sbcglobal.net> wrote:
> It is possible to distribute Mathematica code so that the source
> code cannot be accessed in any meaningful way and be usable
> within Mathematica. Take a look at ReadProtected and Encode.

Not so trivial, actually. Suppose, I load your package after In[4].

It is clear that Encode must be used, but it doesn't help at all.
The person who should be able to run the code, needs the key when
he reads in the package.

Ralf

In[1]:= Unprotect[SetAttributes,Attributes];

In[2]:= SetAttributes[Except[{SetAttributes,Set,Attributes}],_]:={}

In[3]:= Attributes=MyAttributes;

In[4]:= SetAttributes[{SetAttributes,Set,Attributes},
{Protected,Locked}];

In[5]:= a[x_] := Module[{z}, z=x+3, z^2];

In[6]:= SetAttributes[a,{ReadProtected,Locked}];

In[7]:= ??a
Global`a

a[x_] := Module[{z}, z = x + 3, z^2]

In[8]:= Attributes[a]={ReadProtected,Locked};

In[9]:= ??a
Global`a

a[x_] := Module[{z}, z = x + 3, z^2]

In[10]:= ClearAll[SetAttributes]

ClearAll::wrsym: Symbol SetAttributes is Protected.

In[11]:= Unprotect[SetAttributes]

Protect::locked: Symbol SetAttributes is locked.

Out[11]= {}

In[12]:= ClearAll[Attributes]

ClearAll::wrsym: Symbol Attributes is Protected.

In[13]:= Attributes

Out[13]= MyAttributes


  • Prev by Date: Re: Tensor cross vector
  • Next by Date: Re: Extracting graphics from notebook
  • Previous by thread: Re: original meaning of System` functions
  • Next by thread: Re: Mathematica daily WTF (programming everything