Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2007
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2007

[Date Index] [Thread Index] [Author Index]

Search the Archive

RE: Difference between Needs and using the second argument of BeginPackage

  • To: mathgroup at smc.vnet.net
  • Subject: [mg77661] RE: [mg77527] Difference between Needs and using the second argument of BeginPackage
  • From: "Andrew Moylan" <andrew.j.moylan at gmail.com>
  • Date: Thu, 14 Jun 2007 05:38:11 -0400 (EDT)
  • References: <200706120519.BAA09366@smc.vnet.net> <46700F05.1060604@wolfram.com>

Thanks Carl.

Does that mean that using the second argument of BeginPackage is exactly
equivalent to calling Needs *before* calling BeginPackage?


-----Original Message-----
From: Carl Woll [mailto:carlw at wolfram.com] 
Sent: Thursday, 14 June 2007 1:37 AM
To: Andrew Moylan
Cc: mathgroup at smc.vnet.net
Subject: [mg77661] Re: [mg77527] Difference between Needs and using the second
argument of BeginPackage

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



  • Prev by Date: Re: Re: What is the compatibility guide?
  • Next by Date: Re: Problem with Documentation Center in Mathematica 6 under Linux
  • Previous by thread: Re: Difference between Needs and using the second argument
  • Next by thread: SingularityDepth option to NIntegrate in Mathematica 6