Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #1508 > unrolled thread

multiple contexts in package

Started bySebastian Hofer <sebhofer@gmail.com>
First post2011-04-06 09:12 +0000
Last post2011-04-07 12:07 +0000
Articles 2 — 2 participants

Back to article view | Back to comp.soft-sys.math.mathematica


Contents

  multiple contexts in package Sebastian Hofer <sebhofer@gmail.com> - 2011-04-06 09:12 +0000
    Re: multiple contexts in package David Bailey <dave@removedbailey.co.uk> - 2011-04-07 12:07 +0000

#1508 — multiple contexts in package

FromSebastian Hofer <sebhofer@gmail.com>
Date2011-04-06 09:12 +0000
Subjectmultiple contexts in package
Message-ID<inhap5$283$1@smc.vnet.net>
I'd like to create a context for semi-hidden symbols (i.e. only provided if explicitly loaded) in one of my packages. How can I achieve such a thing?
My best bet was the following (inspired by looking at the Parallel package):

BeginPackage["Package`"]
(*visible symbols*)

BeginPackage["Package`Hidden`"]
(*semi hidden symbols*)
EndPackage[]

Begin["`Private`"]
(*hidden symbolds*)
End[]
EndPackage[]

Trying to load Package`Hidden` does not load anything though. Where am I going wrong?

Best regards,
Sebastian

[toc] | [next] | [standalone]


#1527

FromDavid Bailey <dave@removedbailey.co.uk>
Date2011-04-07 12:07 +0000
Message-ID<ink9du$gci$1@smc.vnet.net>
In reply to#1508
On 06/04/2011 10:12, Sebastian Hofer wrote:
> I'd like to create a context for semi-hidden symbols (i.e. only provided if explicitly loaded) in one of my packages. How can I achieve such a thing?
> My best bet was the following (inspired by looking at the Parallel package):
>
> BeginPackage["Package`"]
> (*visible symbols*)
>
> BeginPackage["Package`Hidden`"]
> (*semi hidden symbols*)
> EndPackage[]
>
> Begin["`Private`"]
> (*hidden symbolds*)
> End[]
> EndPackage[]
>
> Trying to load Package`Hidden` does not load anything though. Where am I going wrong?
>
> Best regards,
> Sebastian
>

Maybe this is obvious to you already, but you can always create symbols 
in contexts with arbitrary names, just by typing the full name:

In[624]:= Foo`fred=0

Out[624]= 0

In[625]:= ?Foo`*

Foo`fred

Foo`fred=0

David Bailey
http://www.dbaileyconsultancy.co.uk

[toc] | [prev] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web