Error, attempting to assign to ... which is protected - Maple Programming Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : System : Error Message Guide : attemptingtoassignto

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

 

Description

Examples

See Also

Description

Note: For users of Maple 16 and earlier versions, this error message is displayed when you assign a value to a protected name.

Most Maple systems names are protected by default. Protection is used to prevent names from being modified by the user.

Names can be protected with the function protect, and protection can be removed with unprotect. It is not recommended that you unprotect Maple protected names.

The calling sequence select(type, {unames(), anames(anything)}, protected) returns the set of protected names in Maple.

Examples

Example 1
To verify that a name is protected, use the type(expr,protected) calling sequence.

typea,protected

false

(2.1)

Example 2

If the name is protected, the command returns true.

typesin,protected

true

(2.2)

Example 3

You can protect names using the protect command.

protectmyprotectedname

myprotectedname2

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

Note: Use quotes to prevent evaluation of the name myprotectedname.

Example 4

You can remove protection from a name with the unprotect command.

unprotectmyprotectedname

myprotectedname2

myprotectedname:=2

(2.3)

See Also

protect, type/protected, unprotect