MathGroup Archive 2004

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

Search the Archive

Re: Package and options

  • To: mathgroup at smc.vnet.net
  • Subject: [mg50419] Re: Package and options
  • From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
  • Date: Fri, 3 Sep 2004 03:34:58 -0400 (EDT)
  • Organization: Universitaet Leipzig
  • References: <ch6mcs$26f$1@smc.vnet.net>
  • Reply-to: kuska at informatik.uni-leipzig.de
  • Sender: owner-wri-mathgroup at wolfram.com

Hi,

you must show a and b because otherwise a and b are in the private
context and you don't want to write
fexample1[x,Test`Test1`Prtivate`a->something]

You should give a and b individual usage messages

(*Title : Package for testing options*)

BeginPackage["Test`Test1`"]

fexample1::"usage" = "Help example";

a::usage="a is an option for fexample1[]"
b::usage="b is an option for fexample1[]"

Begin["`Private`"]

Options[fexample1] = {a -> A, b -> B}

fexample1[x_, opts___Rule] := 
  (a + b) x /. {opts} /. Options[fexample1]

End[]

EndPackage[]

But now fexample1[x] return

(Test`Test`Private`A+Test`Test`Private`B)*x and I don't expect
that you like this.

So you should place a usage message for every symbol you what
to use outside the package and for every symbol that can be seen
by the user in some cases.

Regards
  Jens


Guillermo Sanchez wrote:
> 
> Dear friends
> 
> Here is a example package:
> 
> (*Title : Package for testing options*)
> 
> BeginPackage["Test`Test1`"]
> 
> fexample1::"usage" = "Help example";
> 
> Options[fexample1] = {a -> A, b -> B}
> 
> Begin["`Private`"]
> 
> fexample1[x_, opts___Rule] :=
>   (a + b) x /. {opts} /. Options[fexample1]
> 
> End[]
> 
> EndPackage[]
> 
> (*Now I request the package Help*)
> 
> ?"Test`Test1`*"
> 
> (*They are shown not only the fexample1 help but the symbols used in
> Options are also shown. How can I prevend that these symbols (a, A, b,
> B} be shown.
> 
> Other general question:
> 
> When Options should be place inside of the private context?
> Thanks.
> 
> Guillermo*)


  • Prev by Date: RE: Package and options
  • Next by Date: Re: Use of large memory
  • Previous by thread: RE: Package and options
  • Next by thread: making contents and index