jlg@lambda.UUCP (Jim Giles) (02/21/90)
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
cik@l.cc.purdue.edu (Herman Rubin) (02/26/90)
In article <14243@lambda.UUCP>, jlg@lambda.UUCP (Jim Giles) writes: > From article <1944@l.cc.purdue.edu>, by cik@l.cc.purdue.edu (Herman Rubin): ........................ | > 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. I agree that there should be overloaded functions as well as overloaded operators, and that languages and compilers recognize this. But this still does not address the problem of notation. The use of infix notation, etc., is a well-establishd procedure in mathematics. I see no good reason why computer languages should not allow this, and allow this to be extensible and to even have user-defined dialects at this point. -- Herman Rubin, Dept. of Statistics, Purdue Univ., West Lafayette IN47907 Phone: (317)494-6054 hrubin@l.cc.purdue.edu (Internet, bitnet, UUCP)