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: fac41,b87849933931bc93 X-Google-Attributes: gidfac41,public X-Google-Thread: 109fba,b87849933931bc93 X-Google-Attributes: gid109fba,public X-Google-Thread: 103376,b87849933931bc93 X-Google-Attributes: gid103376,public X-Google-Thread: 1108a1,b87849933931bc93 X-Google-Attributes: gid1108a1,public X-Google-Thread: 114809,b87849933931bc93 X-Google-Attributes: gid114809,public From: Alan Lovejoy Subject: Re: OO, C++, and something much better! Date: 1997/02/13 Message-ID: <3302DB3E.F70@concentric.net>#1/1 X-Deja-AN: 218472822 References: <5de62l$f13$1@goanna.cs.rmit.edu.au> <32FB8B51.1759@concentric.net> 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-13T00:00:00+00:00 List-Id: Piercarlo Grandi wrote: > > >>> "alovejoy" == Alan Lovejoy writes: > > alovejoy> Richard A. O'Keefe wrote: > > Richard> [ ... ] I think any fair person would agree that calling "+" an > Richard> operator is not _wholly_ unreasonable, even in Smalltalk. The > Richard> _application_ of "+" to arguments is a message send, but > Richard> "message send" is no more and no less than "dispatched > Richard> procedure call". > > Richard> Anyone saying that "+" is not an operator in Ada, for example, > Richard> on the flimsy grounds that "+" is actually an overloaded > Richard> function, would not be taken seriously. (Except in APL) > Richard> "operator" is a syntactic property, not a semantic one. [ ... ] > > Quite so, but then: > > alovejoy> An "operator" is a "built in" function whose semantics is > alovejoy> defined by the grammar of the language. > > The _semantics_ are defined by the grammar???? > An operator like "+" is a _function_???? Ah, sorry. You've caught me using imprecise terminology. The semantics are defined by the **language**, not the "grammar." And the operator "+" **names** an operation, in this case addition. The compiler resolves the "+" operator to a built-in function (that is, a compiler-defined inlined function or macro) as is appropriate for each usage (assuming the language is statically typed, and that dynamic method dispatch is not required). So in the context of a particular usage, the "+" operator names a particular conceptual function (e.g., "complex number addition"). And of course, the compiler writer could implement the complex number addition operation as an actual function call, should he so desire. > In Smalltalk-80, unconventionally, there are no reserved operator > symbols; but all symbols that are formed out of a certain set of special > characters can/must be used in an affix role that _looks_ like (because > of the absence of ':') infix notation, and might even be regarded as > infix. > > What is builtin in Smalltalk-80 is not operator symbols (the ``message > selector'') but the primitive bytecodes to which they resolve (the > ``method''), which is an operation, not an operator. > > And so on... Well, in most cases, binary message sends resolve to the same bytecode as any other message send ("send selector stored as literal[n]"). What the selector may be is irrelevant to the message-send bytecode. But in a few cases, the bytecode emitted by the compiler will specially reflect the message selector (e.g, "==" and other "no dispatch" messages). It is defensible to call such bytecodes operations--or rather, applying your own criticism to this case, one can call what such bytecodes do "operations" (since the bytecodes are not literally operations, but merely codes that signify operations). -- Alan L. Lovejoy | Why Smalltalk? Smalltalk Consultant | Because I don't want to follow the crowd, alovejoy@concentric.net | but to lead it.