There are some "special variables" in Mathematica that cannot be cleared. These are fundamentally necessary for its operation and while it will let you revert to a default value inside a Block
, it will not allow you to clear it.
You can verify this directly, without Block
:
Clear@$ContextPath
Clear::spsym: Special symbol $ContextPath cannot be cleared. >>
It doesn't work even though $ContextPath
is not Protected
or Locked
.
You can find out which other symbols are special:
Reap[Quiet@Check[Clear@#, Sow@#, Clear::spsym] & /@
Select[Names["System`*"], FreeQ[Attributes@#, Protected] &]] // Last // Last
(* {$ActivationGroupID,$ActivationKey,$ActivationUserRegistered,$AssertFunction,$Assumptions,
$BatchInput,$BoxForms,$CharacterEncoding,$Context,$ContextPath,$HistoryLength,$InputFileName,
$InstallationDirectory,$IterationLimit,$Language,$LicenseExpirationDate,$LicenseID,
$LicenseProcesses,$LicenseServer,$LicenseSubprocesses,$LicenseType,$LoadedFiles,
$MachineAddresses,$MachineDomain,$MachineDomains,$MachineID,$MachineName,$MaxExtraPrecision,
$MaxLicenseProcesses,$MaxLicenseSubprocesses,$MaxPiecewiseCases,$MaxPrecision,$MaxRootDegree,
$MinPrecision,$ModuleNumber,$NetworkLicense,$NumberMarks,$ParentLink,$ParentProcessID,
$PasswordFile,$PatchLevelID,$Path,$ProcessID,$RandomState,$RecursionLimit,
$TemporaryDirectory,$TemporaryPrefix,$TopDirectory,$TraceOff,$TraceOn,$TracePattern,
$TracePostAction,$TracePreAction,$UserBaseDirectory,$UserName} *)
From a quick look at what's in the list, you can easily see that most of these are critical for the software to function.