InitializationObject

InitializationObject[sym,loc]

gives the persistent object where InitializationValue[sym,loc] is stored.

InitializationObject["context`name",loc]

gives the persistent object where the initialization value for the symbol with the specified complete name is stored.

Details and Options

  • In InitializationObject[sym,loc], possible forms for the persistence location loc include:
  • PersistenceLocation["type"]"Local", "Cloud", "FrontEndSession", etc. locations
    "type"equivalent to PersistenceLocation["type"]
    PersistenceLocation["type","base"]location with a particular base (directory etc.)
    "type""base"equivalent to PersistenceLocation["type","base"]
  • Supported location types include:
  • "KernelSession"current invocation of the Wolfram Language kernel
    "FrontEndSession"current invocation of the Wolfram Notebook front end
    "Local"local to a computer, based on user home directory
    "LocalShared"local to a computer, based on $BaseDirectory
    "Cloud"in the cloud defined by the current $CloudBase
    "Installation"installation defaults

Examples

open allclose all

Basic Examples  (2)

Set an initialization value for a variable:

Get the persistent object where the initialization is stored:

Give all properties of the initialization object:

The full name of the variable can be given as a string:

Applications  (2)

Give a default value for a variable:

Set a custom merging function for initialization values of the variable:

Specify initialization values at different persistence locations:

The custom merging function is used to return the list of all values on $PersistencePath:

When the variable is initialized, the default merging function is also used:

Give a default value for an initialization value:

Set a a custom value preprocessing function that accepts only integers:

Assign an integer at any persistence location:

Assigning anything else generates an error, and the assignment is not performed:

Properties & Relations  (1)

Create two initialization values for a symbol in different locations:

InitializationObjects gives all initialization objects found on $PersistencePath:

InitializationObject is used to access a specific object in a given persistence location:

It can be used to find properties of the given initialization object:

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

Text

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

CMS

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

APA

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

BibTeX

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

BibLaTeX

@online{reference.wolfram_2024_initializationobject, organization={Wolfram Research}, title={InitializationObject}, year={2021}, url={https://reference.wolfram.com/language/ref/InitializationObject.html}, note=[Accessed: 30-December-2024 ]}