Re: Needs[], BeginPackage[], filename
- To: mathgroup at smc.vnet.net
 - Subject: [mg101060] Re: [mg101038] Needs[], BeginPackage[], filename
 - From: "David Annetts" <davidannetts at aapt.net.au>
 - Date: Tue, 23 Jun 2009 07:03:54 -0400 (EDT)
 - References: <200906220821.EAA09072@smc.vnet.net>
 
Hi Scott,
> Needs[] allows the context and filename to be specified.
> 
> BeginPackage[] allows a context and not a file name.
> 
> Then, my packages require two steps, as in the following example:
> 
> ** start **
> 
> Needs["sizedistribution`", "size functions.m"]
> 
> BeginPackage["tandemdma`", {"sizedistribution`"}]
> 
> ** stop **
> 
> Are two steps really necessary or am I missing something very simple?
Two steps are not necessary.
 
> My goal would be to just forego Needs[] and handle everything 
> in one step with BeginPackage, but I cannot figure out a way 
> to feed the filename to BeginPackage[].
> 
> I had a search on the MathArchives, but I did not succed in 
> locating any material addressing this question.
This question has been answered before.  
The answer is in the online help.  Search for BeginPackage and you will find
that
BeginPackage["YourContext", {"Packages`You`Need`"}]
will call Needs["Packages`You`Need`"]
Another way to see this is to look in the supplied packages.  They are only
text files and there's a wealth of information there.
D.
- References:
- Needs[], BeginPackage[], filename
- From: "Scot T. Martin" <smartin@seas.harvard.edu>
 
 
 - Needs[], BeginPackage[], filename