Re: Difference between Needs and using the second argument
- To: mathgroup at smc.vnet.net
- Subject: [mg77617] Re: [mg77527] Difference between Needs and using the second argument
- From: Carl Woll <carlw at wolfram.com>
- Date: Thu, 14 Jun 2007 05:15:36 -0400 (EDT)
- References: <200706120519.BAA09366@smc.vnet.net>
Andrew Moylan wrote:
>Is there any difference between (i) using the second argument of
>BeginPackage or (ii) explicitly calling Needs on any required packages?
>
>
The difference is whether the symbols in the required packages are on
the context path after loading the package. For example, with:
BeginPackage["MyPackage`", {"OtherPackage`"}]
after loading
<<MyPackage`
the exported symbols in OtherPackage are also available to the user.
While, with
BeginPackage["MyPackage`"]
Needs["OtherPackage`"]
after loading
<<MyPackage`
the exported symbols in "OtherPackage" are not available to the user.
Carl Woll
Wolfram Research
- References:
- Difference between Needs and using the second argument of BeginPackage
- From: Andrew Moylan <andrew.j.moylan@gmail.com>
- Difference between Needs and using the second argument of BeginPackage