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