Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!uwm.edu!rpi!uupsi!cmcl2!lanl!lambda!jlg From: jlg@lambda.UUCP (Jim Giles) Newsgroups: comp.lang.misc Subject: operator vs. function is a bogus distinction. Message-ID: <14243@lambda.UUCP> Date: 20 Feb 90 23:11:34 GMT References: <1944@l.cc.purdue.edu> Distribution: usa Lines: 28 From article <1944@l.cc.purdue.edu>, by cik@l.cc.purdue.edu (Herman Rubin): > [...] > NO NO NO! An operator is not a function, especially if it is different > for arguments of different types, such as the sum, product, power operators, > etc. True, an operator is not a function. An operator is a syntactic object which (in the right context) _invokes_ a function. A function is a mapping from a domain to a codomain - period. For arguments of differring types the domain may be quite complicated (like the set of ordered pairs of 'numbers' - where 'numbers' is a discriminated union of several base numerical types). The codomain might be similarly complex. > [...] > Also, I see no more reason for a function call, or even function notation, > for power than for sum. It is no more reasonable to require x = pow(y,z) > than x = sum(y,z). I see your problem now. You are making the same mistake that C programmers do. The original C specifications used the word 'operator' for all functions which the compiler was expected to expand inline and it used the word 'function' for all functions which were implemented as procedure calls. This is a bogus distinction! The distinction you are trying to make is between inline functions and external ones. This distinction can be (and _should_ be) independent of the syntactic form which invokes the function. J. Giles