MathGroup Archive 2014

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

Search the Archive

Re: packages...

  • To: mathgroup at smc.vnet.net
  • Subject: [mg132749] Re: packages...
  • From: "djmpark" <djmpark at comcast.net>
  • Date: Thu, 22 May 2014 02:31:27 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • Delivered-to: l-mathgroup@wolfram.com
  • Delivered-to: mathgroup-outx@smc.vnet.net
  • Delivered-to: mathgroup-newsendx@smc.vnet.net
  • References: <20140520001625.43D2D6A45@smc.vnet.net> <28031635.197343.1400660649379.JavaMail.root@m03>

I missed this initial posting but I would like to point out a weakness, a
flaw I think, in the WRI package design.

If you have many packages, then you must make certain that the exported
symbols have a tree-like dependency.  When one uses BeginPackage statements
such as:

BeginPackage[packageA, {needed packages}] 

the code in the needed packages is also read in and if they involve exported
symbols from packages not yet read in (like packageA) then the symbols are
put into a `Private` context. So in the entire Application these symbols
will exist in both a Public and Private context, which doesn't work.

I would think that this problem would be solved if the needed packages part
of the BeginPackage statement only read the Public sections and did not read
the Private sections, if this could be arranged.

With perfect foresight one might write a strictly tree-like structure, but
if an Application is developed over time it might turn out that it becomes
difficult to maintain that structure. Other groupings of routines might seem
more natural.

So, at least for the present, don't go for too many packages in a single
Application.


David Park
djmpark at comcast.net 
http://home.comcast.net/~djmpark/index.html 




From: David William Annetts [mailto:david.annetts at iinet.net.au] 


Absolutely!

I suggest looking at the stock packages for how to do this. Graphics &
Statistics are good places to start.

D.
On 20/05/14 08:16, Francisco Gutierrez wrote:
> Dear Friends:
> I want to create a relatively complex package, with the following
structure:
>
> `mypackage`Master, which can be invoked if one wants all the 
> utilities, and which calls all the subpackages (each one with several 
> functions)
>
> and
>
> `mypackage`Utilities1, ..., `myPackage`Utilitiesn,
>
> which ought to be available for being called independently if one only
needs a couple of specific functions.
>
> Furthermore, `myPackage`Master has common function that all the
subpackages need. What is the best way to proceed? Is it possible to put the
common functions in the Master package, and that each subpackage calls them
when needed?
>
> Thanks for your help
> Francisco
>





  • References:
    • packages...
      • From: Francisco Gutierrez <fgutiers2002@yahoo.com>
  • Prev by Date: Re: Help
  • Next by Date: Re: packages...
  • Previous by thread: Re: packages...
  • Next by thread: ListPointPlot3D[Tooltip[]] Help