MathGroup Archive 2006

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

Search the Archive

Re: Using Notebooks to write packages?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg66873] Re: Using Notebooks to write packages?
  • From: albert <awnl at arcor.de>
  • Date: Fri, 2 Jun 2006 04:08:56 -0400 (EDT)
  • References: <e5mibl$ksh$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Steven T. Hatton wrote:

> I have encountered a problem while working with packages in which a
> package needed when loading the one I'm creating will produce a shadow
> warning. For example if I have

how exactly do you create the package with the Notebook? Are you using the
approach to set AutoGeneratePackage for the Notebook and use the
resulting .m-file as a package file which you load with Get or Needs?

> BeginPackage["Drawing`", {"Graphics`Arrow`"}]
> 
> DrawGrid::usage = "DrawGrid[\[Theta],X,Y,origin, options]";
> ....
> 
> Begin["`Private`"]
> 
> ....
> 
>   DrawGrid[theta_, X_, Y_, o_, opts___?OptionQ] :=
>     Module[{dx = UR[theta], dy = UR[theta + Pi/2], Dx, mXColor, mYColor},
>       mXColor = xColor /. {opts} /. Options[DrawGrid];
>       mYColor = yColor /. {opts} /. Options[DrawGrid];
>       Dx = {o, X dx};
>       Dy = {o, Y dy};
>       {{mXColor
>         ,{Dashing[{0.01}]
>           , Table[Line[{Dx[[1]] + #, Dx[[2]] + #} &@(y dy)], {y, 0, Y}]
>          }
>         , Arrow[o, dx, HeadScaling -> Relative]
>        }
>       ,{mYColor
>         ,{Dashing[{0.01}]
>           ,Table[Line[{Dy[[1]] + #, Dy[[2]] + #} &@(x dx)], {x, 0, X}]
>           }
>           ,Arrow[o, dy, HeadScaling -> Relative]
>         }
>       }
>      ]
> 
> End[]
> 
> EndPackage[]
> 
> I get a shadow warning saying that Arrow and HeadScaling are in multiple
> contexts; global and Graphics`Arrow`.  I checked before loading the
> package, and they were not present in global scope.

how do you load the package you create? Evaluate the Cell/Cells that contain
the code or with Get/Needs from the package file? Is it happening with a
fresh kernel, too?

> I tried creating a 
> very minimal package along the same lines, and using Graphics`Arrow`, and
> I
> didn't get the warning.  I then took all the code I had written and
> rewrote
> it using Emacs, and saved it as a .m file.  No more warning.
> 
> This is on Linux.  Has anybody else encountered this kind of problem? 

no, and I'm using the FrontEnd to generate package files all the time. Linux
(mostly) and Windows.

> I'm 
> inclined to believe the problem has to do with the fact that I created the
> package using the Notebook front end.  It doesn't happen every time I
> create a package using the front end, but I have not identified any kind
> of pattern.

hm. have you had a look at the actual package files when it happens (just
check what exactly the appearances of Arrow and HeadScaling look like...)

just having reread the post, it does not contain too much help, I'm
afraid...

albert


  • Prev by Date: Re: Re: How to get the maximums of a curve
  • Next by Date: Re: Defining N for a new entity
  • Previous by thread: Using Notebooks to write packages?
  • Next by thread: RE:Using Notebooks to write packages?