MathGroup Archive 1997

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

Search the Archive

Re: selective exporting possible?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg8032] Re: [mg7998] selective exporting possible?
  • From: Allan Hayes <hay at haystack.demon.co.uk>
  • Date: Sat, 2 Aug 1997 22:32:41 -0400
  • Sender: owner-wri-mathgroup at wolfram.com

mabi at solidmr.kun.nl (Marlies Brinksma)
in [mg7998] selective exporting possible?
writes
>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!

Marlies,

Two suggestions;

1. Make your function private:

BeginPackage["helper`"];
gg;	
Begin["`Private`"];
ff[x_] := 4
gg[x_]:= 5
End[];
Protect["`*"]
EndPackage[];
  	
Once the package helper is loaded then ff is available under its  
full name helper`Private`ff.

2. Use hidden importation (Roman Marder, Programming in Mathematica  
2nd edn, p36)
Instead of the usual

BeginPackage[..., "helper`" ..]

use

BeginPackage[.....]
Needs["helper`"]

This does not put "helper`" on the context path.
Users cannot use gg ; but nor can they use any functions that you  
may have defined in helper`; and they cannot load "helper`" by  
Needs, (since "helper" is in the list $Packages, which give contexts  
of the loaded packages - you could remove it) -- however <<helper`  
still works.

Allan

Allan Hayes
hay at haystack.demon.co.uk
http://www.haystack.demon.co.uk/
voice:+44 (0)116 2714198
fax: +44 (0)116 2718642
Leicester, UK






  • Prev by Date: Re: MMA 3.0 sound under Linux
  • Next by Date: RE: Wrong behavior of CrossProduct
  • Previous by thread: Re: MMA 3.0 sound under Linux
  • Next by thread: RE: Wrong behavior of CrossProduct