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: 109fba,b87849933931bc93 X-Google-Attributes: gid109fba,public X-Google-Thread: fac41,b87849933931bc93 X-Google-Attributes: gidfac41,public X-Google-Thread: 1108a1,b87849933931bc93 X-Google-Attributes: gid1108a1,public X-Google-Thread: 103376,b87849933931bc93 X-Google-Attributes: gid103376,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/16 Message-ID: #1/1 X-Deja-AN: 219216487 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> 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-16T00:00:00+00:00 List-Id: >>> "alovejoy" == Alan Lovejoy writes: [ ... mostly agreement, BTW, ... ] piercarl> But the conclusion is really that the set of operator symbols piercarl> that a language uses and the (syntactical) rules with which piercarl> some of them are used are a rather independent matter from piercarl> which implementation the symbol denotes, how many, and what is piercarl> their nature (builtin, user defined, macro implemented as an piercarl> extracode, or whatever). alovejoy> Yes, exactly. Any token can be given any meaning, since alovejoy> semantic mapping is arbitrary. There is nothing special about alovejoy> "+", "=" or "return". They are all just sequences of lexical alovejoy> symbols (which is true in any language). This is why I don't alovejoy> like the idea of calling "+" an operator merely because of the alovejoy> lexical symbol(s) with which it is composed. Ah, but I seem to remember that the original observation By Richard O'Keefe was that whatever in most languages one calls operators is things that are used with ``operator'' *syntax* (binary or unary), rather than procedure call syntax, not that operators are those things indicated by ``special'' characters, that is some sort of ``operator'' *lexicon*. For example in ``C'' 'sizeof' indicates a unary operator, and in ``Pascal'' 'div' indicates a binary operator, and so on. ``C'' even has a _ternary_ operator ('?:'), whose invocation syntax is rather distinguished from that of three-argument procedures. You may be a bit misled by your familiarity with ``Smalltallk'', which makes it possible to use ``operator'' syntax only with symbols composed of ``special' characters. But even in ``Smalltalk'' what really distinguishes operators is the type of syntax they are used in, not quite their appearance (even if it is that which implies the use of operator-like syntax). 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). This a bit dangerous (for user-defined operators); besides what really distinguished operator from procedure invocations in most languages is the invocation syntax, not the semantics of the associated procedure, or the lexicon from which the symbol is drawn (which *may* be restricted in some language though). alovejoy> Is there a useful semantic distinction between "function" and alovejoy> "operator" in math? If so, what is it? I would say it's still syntax: operators, however fancily named, tend to be used in binary/unary syntax forms, and functions in applicative (name plus parenthesized arg list) syntax. The two can get a bit confused, especially for unary operators, as in programming languages (for example many ``C'' programmers haven't realized that 'sizeof' is an operator and not a function an write 'int a; a = sizeof(a)', instead of the more appropriate 'sizeof a'). But then mathematicians invent notation all the time; they even have suffix operator (e.g. "!" for factorial) or "around" operators (like "||" for absolute value) and many more types beside. The common thing is not quite that they use non-alphabetic symbols, but that they don't use applicative syntax like 'f(....,....)'; consider for examples of alphabetic operators commonly used in maths things like the 'lim' unary operator notation, or 'sup' as used in Knuth vol 1.