4
$\begingroup$

I evaluated the following in Mathematica 10.2 with a refreshed kernel:

In[1]:= $ContextPath
Out[1]= {CloudObjectLoader`,StreamingLoader`,IconizeLoader`,PacletManager`,System`,Global`}
In[2]:= ?Sin
Out[2]= Sin[z] gives the sine of z.  >>
In[3]:= $ContextPath
Out[3]= {CloudObject`,MailReceiver`,Security`,CloudObjectLoader`,StreamingLoader`,IconizeLoader`,PacletManager`,System`,Global`}

It seems like the evaluation of Information[] (“?” is the short form of Information[]) caused Mathematica to prepend the contexts CloudObject, MailReceiver, and Security to the ContextPath.

Why?
This should not be necessary since Sin[] is a member of the context System which was already included in the ContextPath.

In[4]:= Context[Sin]
Out[4]= System`

I did the same in Mathematica 9.0 and got the following:

In[1]:= $ContextPath
Out[1]= {PacletManager`,QuantityUnits`,WebServices`,System`,Global`}
In[2]:= ?Sin
Out[2]= Sin[z] gives the sine of z.  >>
In[3]:= $ContextPath
Out[3]= {PacletManager`,QuantityUnits`,WebServices`,System`,Global`}

--> The $ContextPath has not been changed by Mathematica 9.0!

Is it possible to suppress this behavior of Mathematica 10.2?

$\endgroup$
  • $\begingroup$ I can't reproduce this, what OS are you using? $\endgroup$ – rcollyer Oct 6 '15 at 13:55
  • $\begingroup$ @rcollyer: Windows 7 / 64 bit $\endgroup$ – Gerhard Wonner Oct 6 '15 at 14:02
  • $\begingroup$ I'll poke somebody with that config here and see what they see. $\endgroup$ – rcollyer Oct 6 '15 at 14:03
  • $\begingroup$ @rcollyer: Thank you! $\endgroup$ – Gerhard Wonner Oct 6 '15 at 14:06
  • $\begingroup$ I can reproduce this behavior on my Mac with v10.2. $\endgroup$ – Bob Hanlon Oct 6 '15 at 14:30
3
$\begingroup$

I see the same behaviour, also using v10.2.0 on Win7/64.

As to the "why", the sequence of events is as follows. As a matter of routine, Information generates a random cell tag for the display cell:

Information screenshot showing cell tags

This cell tag is generated using CreateUUID. CreateUUID, in turn, is autoloaded as part of a collection symbols all somewhat related to cloud functionality. The autoload expression looks like this:

Package`ActivateLoad[CreateUUID, 
  {CloudObject`Utilities`RemoveAuthenticationInformation,
   CloudObject`Utilities`AuthenticationInformation,
   CloudObject`Utilities`AddAuthenticationInformation,
   CloudObject`Internal`RegisteredUserNameStatus,
   CloudObject`Internal`WolframUUIDStatus,
   CloudObject`Internal`WolframIDStatus,
   CloudObject`Internal`CloudConnectStatus,
   CloudObject`Internal`GetAuthentication,
   CloudObject`Internal`SetAuthentication,
   SetUsers, SetCloudDirectory, ScheduledTaskInformationData,
   ScheduledTaskInformation, ScheduledTasks, ScheduledTask,
   RestartInterval, ResponseForm, RemoveUsers, SharingList,
   CloudShare, CloudPublish, ClearPermissions, SetPermissions,
   PermissionsGroups, PermissionsGroup, Permissions,
   NotificationFunction, ReturnReceiptFunction, MailResponseFunction,
   MailReceiverFunction, LocalizeDefinitions, IncludeGeneratorTasks,
   IconRules, HTTPRequestData, HTTPHandler, GeneratorOutputType,
   GeneratorHistoryLength, GeneratorDescription,
   GeneratedDocumentBinding, ExportForm, ExternalBundle,
   EvaluationData, EpilogFunction, DocumentGenerators,
   DocumentGeneratorInformationData, DocumentGeneratorInformation,
   DocumentGenerator, DeliveryFunction, Delayed, CreateUUID,
   CreatePermissionsGroup, ContinuousTask, CloudSymbol, CloudSubmit,
   CloudSave, CloudPut, CloudObjectInformationData,
   CloudObjectInformation, CloudObjects, CloudObject, CloudLoggingData,
   CloudImport, CloudGet, CloudFunction, CloudExport, CloudEvaluate,
   CloudDisconnect, CloudDirectory, CloudDeploy, CloudConnect,
   CloudAccountData, CloudBase, AutoRemove, AutoRefreshed, AddUsers,
   AbortScheduledTask, $RegisteredUserName, $PermissionsGroupBase,
   $Permissions, $HTTPRequest, $EvaluationEnvironmentParameters,

$CloudSymbolBase, $CloudRootDirectory, $CloudCreditsAvailable, $CloudConnected}, "CloudObjectLoader", {PackageHiddenImport -> False, Path -> Automatic}]

The extra packages are all referenced directly or indirectly by these symbols.

The random cell tag is not strictly necessary for the case of ?Sin. However, if we had typed ?*Sin instead then we would obtain a list of hyperlinked symbols. When we click on one of the symbols, the usage information appears in the cell below. The cell tag is used to locate and remove any such information from a previous click. The code that generates the usage cell always adds a tag, whether there are hyperlinks or not. Using a UUID for this purpose means that the code need not check for explicit uniqueness since the chances are phenomenally slim that there will be a collision.


As to the prospect of suppressing this behaviour, it seems like any measures taken by anyone other than WRI run the risk of interfering with normal system operation.

$\endgroup$
  • $\begingroup$ Any idea why this output of a help-text in my local notebook needs to get a globally unique id? $\endgroup$ – Gerhard Wonner Oct 6 '15 at 15:18
  • $\begingroup$ I added a paragraph to explain the purpose of tagging the generated cells with a unique id. $\endgroup$ – WReach Oct 6 '15 at 16:38
  • $\begingroup$ Nice, thank you! $\endgroup$ – Gerhard Wonner Oct 7 '15 at 6:43
  • $\begingroup$ Internal`InheritedBlock[{$ContextPath},?Sin] restores the $ContextPath afterwards, I guess that should be safe. $\endgroup$ – celtschk Oct 22 '15 at 9:57
  • $\begingroup$ @celtschk I agree that it is probably safe, to the extent that the additions to $ContextPath were actually unintentional. A dedicated spelunker might be able to make that determination, but such assessment would be easier for WRI since they know the true intent -- and have all of the source code :) It certainly seems like the additions should not be there, somewhat like the case of (88393). $\endgroup$ – WReach Oct 22 '15 at 14:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.