MathGroup Archive 2010

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

Search the Archive

Re: SetAttributes for entire package

  • To: mathgroup at smc.vnet.net
  • Subject: [mg111346] Re: SetAttributes for entire package
  • From: Albert Retey <awnl at gmx-topmail.de>
  • Date: Wed, 28 Jul 2010 02:55:02 -0400 (EDT)
  • References: <i2mhck$3ct$1@smc.vnet.net>

Hi,

> Is there a way to SetAttributes for all of the functions in a package?  I
> would like them all to be Locked and ReadProtected.

you can get a list of all symbol names in your package with:

Names["MyContext`*"]

using SetAttributes on that list should work alright (I haven't tested
the following but done things like this before):

SetAttributes[ToExpression[Names["MyContext`*"]],{ReadProtected,Locked}]

if you have symbols that have OwnValues defined in your package, you
might need to delete those from the list of all symbols or need to be
more careful when creating symbols from the symbol names. You also might
want to protect the private functions of your package, if there are any...

hth,

albert


  • Prev by Date: Re: NDSolve - how to bypass safety chceck?
  • Next by Date: Student's T Confidence Interval [StudentTCI]
  • Previous by thread: Re: SetAttributes for entire package
  • Next by thread: Re: SetAttributes for entire package