I want to import a package in a way that requires me to use the long names for package symbols, just as if I had created the context on the fly. What is the idiomatic way to do this?


1 Answer 1


I don't know if you really want what you said you want. That is because if you load a package, all symbols are already created, just by parsing.

What you can do is to not introduce new contexts on $ContextPath which will force you to use long names.

It is mentioned in Leonid's answer in What are the use cases for different scoping constructs? but it is probably to broad to mark as a duplicate.

Block[{$ContextPath}, Get@"JLink`"]

enter image description here

About parsing and symbol lookup you can read in

Your question can be interpreted also in that way:

  random := random = (Pause[1]; 4);

Now random symbol is also created instantaneously but it will be defined after you call the first time.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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