Loading packages within packages
- To: mathgroup at smc.vnet.net
- Subject: [mg30240] Loading packages within packages
- From: "Oliver Friedrich" <oli.fri at gmx.de>
- Date: Fri, 3 Aug 2001 00:56:09 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
Hallo NG,
I have some trouble with a self written package that reqires other packages.
It looks like this:
BeginPackage["MyPackage`",{"PackageA`"}]
MyFunctionA::usage=
"blablabla"
Begin["`Private`"]
MyFunctionA[a_:defaultA]:=ExternalFunctionA[a]
End[]
EndPackage[]
Now my problems:
ExternalFunctionA is defined in PackageA`. When I load this package and use
MyFunctionA, the following happens:
In:=
MyFunctionA[]
Out:=
MyPackage`Private`ExternalFunctionA[MyPackage`Private`defaultA]
1. Why is ExternalFunctionA connected to MyPackage`Private` context and not
to PackageA` context? Of course, in this case ExternalFunctionA doesn't work
! What am I doing wrong?
2. How can I supress the complete context of defaultA? When I call
MyFunctionA with the parameter it looks like this:
In:=
MyFunctionA[parameter]
Out:=
MyPackage`Private`ExternalFunctionA[parameter]
3. A more general question:What's the correct way to write *.m files,
especially how to save them correctly. The way I do seems to be a little bit
weird to me
I have the Mathematica book, but this one is not explained thouroughly
enough. I'm running Version 3.0 !
Thanks for any suggestions
Oliver Friedrich