From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=0.2 required=5.0 tests=BAYES_00,INVALID_MSGID, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,b87849933931bc93 X-Google-Attributes: gid103376,public X-Google-Thread: fac41,b87849933931bc93 X-Google-Attributes: gidfac41,public X-Google-Thread: 109fba,b87849933931bc93 X-Google-Attributes: gid109fba,public X-Google-Thread: 114809,b87849933931bc93 X-Google-Attributes: gid114809,public X-Google-Thread: 1108a1,b87849933931bc93 X-Google-Attributes: gid1108a1,public From: Alan Lovejoy Subject: Definition of "operator" (was: OO, C++, and something much better!) Date: 1997/02/16 Message-ID: <330789FA.40A5@concentric.net>#1/1 X-Deja-AN: 219238115 References: <5de62l$f13$1@goanna.cs.rmit.edu.au> Content-Type: text/plain; charset=us-ascii Organization: Modulation Mime-Version: 1.0 Reply-To: alovejoy@concentric.net Newsgroups: comp.lang.c++,comp.lang.smalltalk,comp.lang.eiffel,comp.lang.ada,comp.object X-Mailer: Mozilla 3.01Gold (Win95; I) Date: 1997-02-16T00:00:00+00:00 List-Id: Jon S Anthony wrote: > > In article <33054E63.C2A@concentric.net> Alan Lovejoy writes: > > > Is there a useful semantic distinction between "function" and "operator" > > in math? If so, what is it? > > Generally speaking, the terms "operator" and "operation" are used to > refer to functions which map an "n-order" set to the "base" or > "1-order" set. Let A be a set and A^n be the cross product of A with > it self n times (n could be 1). If f is a function from A^n to A, > f:A^n -> A, then f is an "n-ary operation". For example, addition is > a simple binary operation on N (set of naturals). The identity > operation is a simple unary operation for any set. Strictly speaking, > the term "operator" is used to refer to the particular symbol for the > operation, but in practice (outside a strictly formal account) this is > typically "slopped over". Ok. So here's a theory: the term "operator" in programming languages was coined by applying it to those built-in procedures which were intended to be analogs of math functions that formally qualify as "operations." Later, other "built-in" procedures also got called "operators" by (uninformed) analogy. If the theory is true, then a case could be made that a procedure should be called an "operation" (and its name an "operator") if its math analog formally qualifies as an "operation" (a function whose domain is an n-order set and whose range is a 1-order set, such as "f(Complex, Complex): Complex"). I'm not advocating this definition for use in computer science, but just suggesting it as a point of discussion. It could be criticised as an ill-advised attempt to pretend that math functions and program procedures are equivalent (perhaps Piercarlo would like to comment?). It could also be criticized as not in accord with current practice in various programming languages (but whether that matters is debatable, since the terminology of language-independent computer science can differ from that of any particular programming language). Also, if the proposed definition of "operator/operation" is adopted, what would be a good term for tokens such as "return" (in C or C++), or the return ("^") and assignment (":=") symbols in Smalltalk, that represent "built in" actions whose semantics are defined by the language? Such have frequently been called "operators" in the past. Is that the "right" term, or should some other term be used instead? So the question is: shat should the terms "operator" and "operation" mean in computer science? Do you think the meaning of these terms should or should not be anologous to their meaning in math? Why or why not? -- Alan L. Lovejoy | Why Smalltalk? Smalltalk Consultant | Because I don't want to follow the crowd, alovejoy@concentric.net | but to lead it.