Protected

Protected

is an attribute that prevents any values associated with a symbol from being modified.

Details

  • Many builtin Wolfram Language functions have the attribute Protected.
  • SetOptions can be used on symbols with attribute Protected that do not also have the Locked attribute.

Examples

open allclose all

Basic Examples  (2)

String has the attribute Protected:

Set the attribute Protected on f:

Scope  (1)

Simultaneously protect and read protect the function f:

f has both attributes:

Simultaneously clear both attributes:

Both have been cleared:

Applications  (1)

Unprotect a system symbol to make a definition for it:

Restore protection:

Properties & Relations  (5)

Protecting a symbol is equivalent to setting the Protected attribute:

Unprotecting a symbol is equivalent to clearing the Protected attribute:

No more definitions can be made for a protected symbol:

Neither can definitions be cleared:

To modify definitions of a protected symbol, unprotect it first:

SetOptions can be used the change the default options of a protected function:

Change the options of D:

Restore the system default:

A symbol that is locked and protected can no longer be changed:

Wolfram Research (1988), Protected, Wolfram Language function, https://reference.wolfram.com/language/ref/Protected.html.

Text

Wolfram Research (1988), Protected, Wolfram Language function, https://reference.wolfram.com/language/ref/Protected.html.

CMS

Wolfram Language. 1988. "Protected." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/Protected.html.

APA

Wolfram Language. (1988). Protected. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/Protected.html

BibTeX

@misc{reference.wolfram_2024_protected, author="Wolfram Research", title="{Protected}", year="1988", howpublished="\url{https://reference.wolfram.com/language/ref/Protected.html}", note=[Accessed: 22-December-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_protected, organization={Wolfram Research}, title={Protected}, year={1988}, url={https://reference.wolfram.com/language/ref/Protected.html}, note=[Accessed: 22-December-2024 ]}