MathGroup Archive 1997

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

Search the Archive

AW: selective exporting possible?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg8038] AW: [mg7998] selective exporting possible?
  • From: Buttgereit <Buttgereit at compuserve.com>
  • Date: Sat, 2 Aug 1997 22:32:46 -0400
  • Sender: owner-wri-mathgroup at wolfram.com

Hi Marlies,
what about the following:

consider the test package test.m:

BeginPackage["test`Test`"];
Begin["`Private`"];
privatef[x_]:=3Dx^2;
End[];
EndPackage[];

then start Mathematica:

In[1]:=3D <<test.m

In[2]:=3D ?priv*
Information::"nomatch": "No symbol matching \!\(\"priv*\"\) found."

In[3]:=3D privatef[2]
Out[3]=3D privatef[2]

In[4]:=3D test`Test`Private`privatef[2]
Out[4]=3D 4

In summary: Do not export the symbols in question to Global` (-> do not
make usage statement). Use these functions with their full name:
Context`Private`function[ ].

You'll probably find an improvement of convenience... Help on this topic
can be found in Maeder: "Programming in Mathematica" (Addison-Wesley,
'91)(!!) and "The Mathematica Programmer" (Academic Press, '94).

You could redefine privatef[] in a new package:

Begin["test`NewPackage`"];
Begin["`Private`"];
f[x_]:=3Dtest`Test`privatef[x];
End[];
EndPackage[];

Be aware that options names contain the context, too! You will need to us=
e
full names here, too:
test`Test`option1-> val1 instead of just option1 -> val1.

That's how I'd tackle the problem...

Greetings,
Peter

----------
>From: mabi at solidmr.kun.nl (Marlies Brinksma)
>Subject: [mg8038] [mg7998] selective exporting possible?

Hello everybody!

I have implemented some packages. The problem which I've encountered =

has to do with their interface. There is one function defined in one of
these packages which I would like to be "visable" for the other packages,=

but NOT for the user!

Does anyone know how I can do this?

Thanks in advance for any help!

Marlies Brinksma





  • Prev by Date: RE: Wrong behavior of CrossProduct
  • Next by Date: Re: Re: Wrong behavior of CrossProduct
  • Previous by thread: Re: Re: Re: Wrong behavior of CrossProduct
  • Next by thread: Re: Re: [Q]contour integral in MMA3.0