Error: attempting to assign to ... which is protected

Most of the standard names that Maple uses, in particular the names of functions, are protected. This makes it impossible to assign a new value to them, and generates the error message above if you attempt to do so. Without this feature, you might accidentally use the name of a Maple function as a variable and assign it a value. Then later when some Maple code tried to call this function, the value you gave it would be used instead of the original definition, causing an error that might be hard to identify and correct.

To tell whether the name X is protected, you can use

> type(X, protected);

false

This would return true if the name was protected.

> type(sin,protected);

true

You can also protect names using the protect command:

> protect('foo');

> foo:= 3;

Error, attempting to assign to `foo` which is protected

Note the quotes, to prevent premature evaluation of the name foo .

It is possible to remove the protection from a name (whether it was protected by you or by Maple) with unprotect :

> unprotect('foo');

> foo:= 3;

foo := 3

It is dangerous to do this for names protected by Maple: it is often very hard to tell what functions Maple may end up calling, even when they appear to be quite irrelevant to what you are doing.

See also: protect unprotect , type[protected]

Maple Advisor Database R. Israel, 1997