MathGroup Archive 2006

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

Search the Archive

Using Notebooks to write packages?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg66852] Using Notebooks to write packages?
  • From: "Steven T. Hatton" <hattons at globalsymmetry.com>
  • Date: Thu, 1 Jun 2006 06:55:33 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

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 

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.  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? 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.

-- 
http://www.mathematica-users.org/
http://www.ifi.unizh.ch/math/bmwcs/master.html
http://www.w3.org/Math/
http://230nsc1.phy-astr.gsu.edu/hbase/hframe.html


  • Prev by Date: Re: Mathematica Font problems
  • Next by Date: Re: Re: Exporting Graphics to .eps
  • Previous by thread: Re: Problem with a limit.
  • Next by thread: Re: Using Notebooks to write packages?