PartProtection

PartProtection

is an option for cloud expressions that controls which parts of their structure can be changed.

Details

  • The setting for PartProtection specifies which parts of lists and associations in a cloud expression are protected from being modified in place.
  • Possible settings include:
  • Automaticonly individual elements can be changed
    Allnothing in the expression can be changed
    Noneeverything can be changed
  • When a change is attempted on a part of a cloud expression not allowed by the setting of PartProtection, a Failure object is returned.
  • With the setting PartProtection->All, deleting the cloud expression using DeleteCloudExpression and resetting its value with Put are still allowed.

Examples

Basic Examples  (2)

Create a CloudExpression storing a scoreboard:

In[1]:=
Click for copyable input
Out[1]=

Check that the PartProtection is set to Automatic:

In[2]:=
Click for copyable input
Out[2]=

Increment the number of attempts of user "user2", which is an atomic subpart of the cloud expression:

In[3]:=
Click for copyable input

Append a new user:

In[4]:=
Click for copyable input

Retrieve the latest value:

In[5]:=
Click for copyable input
Out[5]=

Attempt to modify the value of key "user1", whose value is an association:

In[6]:=
Click for copyable input
Out[6]=

Disable part protection:

In[7]:=
Click for copyable input
Out[7]=
In[8]:=
Click for copyable input
Out[8]=

The modification was applied:

In[9]:=
Click for copyable input
Out[9]=

Create a new cloud expression with full part protection:

In[1]:=
Click for copyable input
Out[1]=

Try to append a value:

In[2]:=
Click for copyable input
Out[2]=

Set the part protection to None and try again:

In[3]:=
Click for copyable input
In[4]:=
Click for copyable input

Retrieve the updated value:

In[5]:=
Click for copyable input
Out[5]=

See Also

CloudExpression  CreateCloudExpression  Permissions  SetOptions  Options  Protected

Introduced in 2016
(10.4)