MathGroup Archive 2001

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

Search the Archive

Loading packages within packages


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





  • Prev by Date: Calculating Covariance Matrix
  • Next by Date: Trouble with Mathematica 4.1 after uninstalling Mathematica 3.0
  • Previous by thread: Re: Calculating Covariance Matrix
  • Next by thread: RE: Loading packages within packages