MathGroup Archive 2005

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

Search the Archive

Re: UpValues for expressions headed by a string


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?