Justin Walker on Fri, 12 Nov 2004 23:03:01 +0100


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: read-only variable



On Nov 12, 2004, at 10:59, Igor Schein wrote:

On Wed, Aug 25, 2004 at 01:13:20PM -0700, Ilya Zakharevich wrote:
On Tue, Aug 24, 2004 at 05:50:18PM -0400, Igor Schein wrote:
Hi,

I propose a function protect(var), which would make variable var
write-protected for the duration of the session to guard against
accidental over-writing.  Is it easy to implement?

Is not it "the same" as a function without parameters?
[snip]
I'd be curious to find out if any other mathematical package offers
variable protection feature.  I really feel it's very useful for
interactive sessions.

Mathematica has this functionality. Each variable has attributes associated with it, one of which is Protected; this prohibits changing the value(s) associated with the variable. There are functions to set and clear this attribute.

Regards,

Justin

--
Justin C. Walker, Curmudgeon-At-Large  *
Institute for General Semantics        | Some people have a mental
                                       |  horizon of radius zero, and
                                       |  call it their point of view.
                                       |     -- David Hilbert
*--------------------------------------*-------------------------------*