MathGroup Archive 2005

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

Search the Archive

Re: UpValues for expressions headed by a string

  • To: mathgroup at smc.vnet.net
  • Subject: [mg63086] Re: UpValues for expressions headed by a string
  • From: dh <dh at metrohm.ch>
  • Date: Tue, 13 Dec 2005 03:41:46 -0500 (EST)
  • References: <dn8fra$bof$1@smc.vnet.net> <dn8r0m$hl5$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Hi Trevor,
according to our private conversation you have problems implementing a 
function that takes different types in different packages.

Well, a symbol can only live in one context. Therefore, if you define 
the behaviour of a symbol in more than one package, you must take care 
to give the right context:
- The first package will set the context. The usage message must go here.
- all further packeges must address the symbol with the right context. 
No usage statement here.

Here is an example:

BeginPackage["aa`"];
fun::usage = "blabla";
Begin["Private`"]
fun[x_Integer] := Print[x];
End[]
EndPackage[]

BeginPackage["bb`"];
Begin["Private`"]
aa`fun[x_String] := Print[x];
End[]
EndPackage[]

Note the aa` in the second package.

Daniel


  • Prev by Date: Re: How to compute this sum?
  • Next by Date: Re: Re: How to hide a cell?
  • Previous by thread: Re: UpValues for expressions headed by a string
  • Next by thread: Re: Bug in Graphics output of Circle primitive?