Protecting variables



--- Richard Fateman <fateman@cs.berkeley.edu> wrote:
> 1. I like making protect available, since it solves a problem.
> And if someone wants to read lisp code into his Maxima that works
> for him, who can order him to stop?!?

Nobody, of course.  My thinking was if someone creates a useful feature
for a specific case, from a system consistency point of view it might
be worth considering adding the feature to the main system, so anyone
else who wants the feature has a "standard" version present they can
use.  However, this may not be practical in a general case.

> 2. I agree that there are issues, some of which have not yet
> been mentioned, so I'll mention those that come to mind.
> 
> If p is protected, can you do  assume(p>0)?  declare(p,float)?
> That is, do you protect only the value, but not other properties?

Hmm, very good point.  If p is an expression, say x^2-y^2, you might
want to be able to say assume positive.  My first instinct would be to
protect only the value, but perhaps a more general case could be
arrived at?  Something like protect(p, value, p>0, float) which allows
explicit protection of a user listed property if they so desire?
 
> Can you protect local symbols (e.g. within a
> block([p:34],protect(p)..))?

Probably you would want to be able to do this.  I'm not sure how useful
it would be in this context.  I don't see how it would hurt.

> Can you protect one entry in an array or the whole array? or
> neither?

Do you mean a position in an array?  Or a variable which is contained
in an array?  Or the size of the array, but not the values inside it? I
can see where that gets sticky.  I'd say the simplest case would be to
avoid being able to protect arrays by default.  But that is not the
most useful thing to do.

OK, I guess this is a little complicated to define a general function
for, at least not without a lot of thinking I'm not qualified for. 
Nevermind - I guess we can come back to it when Maxima reaches the
point where we don't have higher priority stuff to fix.  Indeed, some
things like package and object issues might change the discussion at a
rather fundamental level.

CY

__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free web site building tool. Try it!
http://webhosting.yahoo.com/ps/sb/