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=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fac41,b87849933931bc93 X-Google-Attributes: gidfac41,public X-Google-Thread: 103376,b87849933931bc93 X-Google-Attributes: gid103376,public X-Google-Thread: 109fba,b87849933931bc93 X-Google-Attributes: gid109fba,public X-Google-Thread: 1108a1,b87849933931bc93 X-Google-Attributes: gid1108a1,public X-Google-Thread: 114809,b87849933931bc93 X-Google-Attributes: gid114809,public From: piercarl@sabi.demon.co.uk (Piercarlo Grandi) Subject: Re: OO, C++, and something much better! Date: 1997/02/19 Message-ID: #1/1 X-Deja-AN: 219767031 X-NNTP-Posting-Host: sabi.demon.co.uk X-Disclaimer: Contents reflect my personal views only References: <5de62l$f13$1@goanna.cs.rmit.edu.au> <32FB8B51.1759@concentric.net> <3302DB3E.F70@concentric.net> <33054E63.C2A@concentric.net> <330794C0.55E@concentric.net> Content-Type: text/plain; charset=US-ASCII Organization: Home's where my rucksack's Mime-Version: 1.0 (generated by tm-edit 7.94) Newsgroups: comp.lang.c++,comp.lang.smalltalk,comp.lang.eiffel,comp.lang.ada,comp.object Date: 1997-02-19T00:00:00+00:00 List-Id: >>> "jsa" == Jon S Anthony writes: jsa> In article jsa> piercarl@sabi.demon.co.uk (Piercarlo Grandi) writes: alovejoy> Whether it's an operator or not should depend either on some alovejoy> mathematical property of its semantics (e.g., it is required alovejoy> to be associative, or transitive, or commutative, or some alovejoy> such). [ ... ] For example, according to Jon Anthony, an alovejoy> "operator" in math should be a function of the form "f: A^n -> alovejoy> A". That is precisely the sort of thing I was reaching for; [ alovejoy> ... ] piercarl> Ahhh, but is the definition of "operator" as in ``operator piercarl> theory''; as you write a *function* is called an "operator piercarl> [function]" if it is of the given form. But operator functions piercarl> and operators are quite different entities. jsa> I think what you really want to say is simply that you don't think jsa> the standard mathematical usage is appropriate in the context of PL jsa> definitions. Not at all: I don't think that the use of the word "operator" as a short form of "operator function" is what people mean by "operator" on its own. There in maths operator symbols that do not label operator functions; viceversa there are operator functions that are not labeled by an operator symbol. I am discussing what makes a symbol into an operator symbol (distinguished syntax and usually lexicon); Alan when a procedure should be called an "operator", even if is name does not at all look like an operator. In my view 'sizeof' is an operator; he seems to be arguing that (lambda (x y) (+ (^ y 3) (+ 2 (* y (* e y))))) is an operator because it computes an operator function. jsa> Alan, OTOH, seems to think that it is a good idea to maintain some jsa> consistency with the mathematical usage. It's not obvious to me jsa> which of these two views is "better". piercarl> The discussion was really about what looks like operators. Now piercarl> there are a lot of things that look like operators in maths, piercarl> which do not indicate an operator function. jsa> That's only because you've become attached to this idea that jsa> operators and operations are some how defined by their "looks". Well, of course, because we are discussing operaror _symbols_, not functions or procedures. The discussion arose out of discussing "+", if I remember well. jsa> Not so. If anything, it is the other way around. The semantics jsa> come first and if it is deemed "special enough" to call out in a jsa> certain context, a particular distinctive symbol (and much more jsa> rarely, syntax) is chosen. But no! As you argue a few lines below, mathematicians use special syntax and lexicon to label functions that are not operator functions!; similarly in programming languages there are many operators that do not compute operator functions, for example 'sizeof' in ``C'', or '^' in ``Smalltalk''. piercarl> examples and draw general rules. In maths operators are piercarl> symbols that essentially always have some distinguished piercarl> syntatic role, and very often are drawn from some piercarl> distinguished lexicon too. jsa> Sorry, this is just is not true. The following are operators on jsa> the set of Reals and none have any "distinguished syntax". jsa> f(x) = x^2 + pi*x^(1/3) jsa> g(y) = y^3 + 2y*e^y No, these are two _functions_ that belong to the set of _operator functions_. jsa> The next two do have special symbols: jsa> x^(1/2), Square root jsa> Sin(x) piercarl> I am not quite sure that syntactic/lexical shorthands actually piercarl> help in programming, but most programming language designers, piercarl> in the doubt, provide some sort of maths-like distinguished piercarl> syntax for operators. jsa> it isn't obvious that this helps a lot in programming. Indeed! That is *my* point. In fact I think it is unhelpful. But then there is an opinion that programs, in particular OO programs, ``model directly the real world'', where the ``real world'' can be maths; and thus: class complex a,b,c; .... a = b + c; is a very good idea, for it immediately suggests, notationally, that the program and the ``real world'' are in such a close relationship, as they should be. However I don't subscribe to that point of view; to me using notation to suggest that 'class complex' and 'the Complex plane' are in close correspondence is not such a good idea, and not very useful in any case.