$ContextAliases
✖
$ContextAliases
is a global variable that gives an association with mappings from aliases to contexts.
Details

- $ContextAliases takes the form <"alias1`""context1`","alias2`""context2`",… >, where aliasi can be any string of characters that could be used to create a legal symbol name. contexti must be a fully qualified context name.
- An alias can be used in place of a fully qualified context when referring to symbols. For a given symbol context`symbol, the name alias`symbol may be used in its place.
- $ContextAliases can be modified directly. It is also updated automatically by calls to Needs, EndPackage and End. »
Examples
open allclose allBasic Examples (1)Summary of the most common use cases
Define a symbol in a specific context:

https://wolfram.com/xid/0k8f69axe6vn4-bqewt9
Create an alias for Context1`Context2`:

https://wolfram.com/xid/0k8f69axe6vn4-hlqlfy
Use the alias to reference the symbol:

https://wolfram.com/xid/0k8f69axe6vn4-bsmz8d


https://wolfram.com/xid/0k8f69axe6vn4-bsaerh
Scope (8)Survey of the scope of standard use cases
Creating Context Aliases (4)
$ContextAliases must be an association with entries of the form "alias""context`":

https://wolfram.com/xid/0k8f69axe6vn4-q5jyek


Aliases cannot represent relative contexts:

https://wolfram.com/xid/0k8f69axe6vn4-cq86x8


Aliases must form legal symbol names:

https://wolfram.com/xid/0k8f69axe6vn4-k3002q



https://wolfram.com/xid/0k8f69axe6vn4-wwf85

Needs can create a context alias:

https://wolfram.com/xid/0k8f69axe6vn4-dgmjay

Use PackedArrayQ from the Developer Utilities Package:

https://wolfram.com/xid/0k8f69axe6vn4-tvxc4w

Since "Developer`" is not on $ContextPath, the unqualified symbol name is not resolved:

https://wolfram.com/xid/0k8f69axe6vn4-u52nfs

Using Context Aliases (4)
Aliases are resolved before creating new symbols:

https://wolfram.com/xid/0k8f69axe6vn4-fn28jq

An alias may represent multiple levels of contexts:

https://wolfram.com/xid/0k8f69axe6vn4-ba9hw1

All ways of typing in a symbol respect context aliases:

https://wolfram.com/xid/0k8f69axe6vn4-l7gwa0


https://wolfram.com/xid/0k8f69axe6vn4-psnu8n


https://wolfram.com/xid/0k8f69axe6vn4-3g8hdm

Properties & Relations (9)Properties of the function, and connections to other functions
Context aliases work in ToExpression:

https://wolfram.com/xid/0k8f69axe6vn4-z8uy7

A context alias is resolved in held evaluations:

https://wolfram.com/xid/0k8f69axe6vn4-lf3zr0

Symbol resolves context aliases:

https://wolfram.com/xid/0k8f69axe6vn4-8ofh6


Changes made to aliases after BeginPackage will be restored after the matching EndPackage:

https://wolfram.com/xid/0k8f69axe6vn4-c4es0g

End restores $ContextAliases to the value it had before the matching Begin:

https://wolfram.com/xid/0k8f69axe6vn4-hex3sg

Names resolves context aliases by default:

https://wolfram.com/xid/0k8f69axe6vn4-ljn3oy

Use the ResolveContextAliases option to prevent alias resolution:

https://wolfram.com/xid/0k8f69axe6vn4-iz9cwc

NameQ behaves identically:

https://wolfram.com/xid/0k8f69axe6vn4-4rb3j9

Contexts resolves aliases by default:

https://wolfram.com/xid/0k8f69axe6vn4-cgcx4w

Use the ResolveContextAliases option to prevent alias resolution:

https://wolfram.com/xid/0k8f69axe6vn4-g3z0kk

Information resolves aliases by default:

https://wolfram.com/xid/0k8f69axe6vn4-mnz331

Information also uses aliases when resolving string patterns:

https://wolfram.com/xid/0k8f69axe6vn4-pa9wp7

Use the ResolveContextAliases option to prevent alias resolution:

https://wolfram.com/xid/0k8f69axe6vn4-kg1st

An active alias cannot be added to $ContextPath:

https://wolfram.com/xid/0k8f69axe6vn4-djtr67


Possible Issues (1)Common pitfalls and unexpected behavior
Aliases can mask existing contexts:

https://wolfram.com/xid/0k8f69axe6vn4-szvg2i

https://wolfram.com/xid/0k8f69axe6vn4-j0zxgz


Because of the aliases, the symbol cont`x is not accessible:

https://wolfram.com/xid/0k8f69axe6vn4-pl0rlf

Removing the clashing alias will restore access to the masked context:

https://wolfram.com/xid/0k8f69axe6vn4-srm7uh

https://wolfram.com/xid/0k8f69axe6vn4-h6lj32

Wolfram Research (2021), $ContextAliases, Wolfram Language function, https://reference.wolfram.com/language/ref/$ContextAliases.html.
Text
Wolfram Research (2021), $ContextAliases, Wolfram Language function, https://reference.wolfram.com/language/ref/$ContextAliases.html.
Wolfram Research (2021), $ContextAliases, Wolfram Language function, https://reference.wolfram.com/language/ref/$ContextAliases.html.
CMS
Wolfram Language. 2021. "$ContextAliases." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/$ContextAliases.html.
Wolfram Language. 2021. "$ContextAliases." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/$ContextAliases.html.
APA
Wolfram Language. (2021). $ContextAliases. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/$ContextAliases.html
Wolfram Language. (2021). $ContextAliases. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/$ContextAliases.html
BibTeX
@misc{reference.wolfram_2025_$contextaliases, author="Wolfram Research", title="{$ContextAliases}", year="2021", howpublished="\url{https://reference.wolfram.com/language/ref/$ContextAliases.html}", note=[Accessed: 25-May-2025
]}
BibLaTeX
@online{reference.wolfram_2025_$contextaliases, organization={Wolfram Research}, title={$ContextAliases}, year={2021}, url={https://reference.wolfram.com/language/ref/$ContextAliases.html}, note=[Accessed: 25-May-2025
]}