MathGroup Archive 2010

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

Search the Archive

Re: overloading a function name in a package? How to query all names?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg110801] Re: overloading a function name in a package? How to query all names?
  • From: Bill Rowe <readnews at sbcglobal.net>
  • Date: Wed, 7 Jul 2010 07:42:18 -0400 (EDT)

On 7/6/10 at 5:03 AM, nma at 12000.org (Nasser M. Abbasi) wrote:

>I have package where I overloaded the same function name, defined to
>accept different arguments. as follows:

>BeginPackage["foo`"]
>boo1::usage="call me as follows: boo1[a,b]" boo1::usage="call
>me as follows: boo1[a]"
>Begin["`Private`"]
>boo1[a_,b_]:=Module[{},Print["in v1 of boo1"]];
>boo1[a_]:=Module[{},Print["in v2 of boo1"]];
>End[] EndPackage[]

>And when I do

>?foo`*

>It only list boo1 once. It seems to show the ::usage of the last
>one. OK. I can understand this.

>But, then, is there a way to show the user than I have more than one
>version of the same function name in the package? Without having to
>look into the package file?

What is wrong with putting all of the information you want
presented into a single usage message? For example:

boo1::usage="call me as either boo1[a,b] or boo1[a]"



  • Prev by Date: Re: The side-effects of mixing TraditionalForm inside
  • Next by Date: Re: Change Default Button Method
  • Previous by thread: overloading a function name in a package? How to query all names?
  • Next by thread: Re: overloading a function name in a package? How to query all names?