home *** CD-ROM | disk | FTP | other *** search
- From: kers@hplb.hpl.hp.com (Chris Dollin)
- Date: Thu, 3 Sep 1992 09:13:40 GMT
- Subject: Re: O.M(...) vs M(...), and is the Real World O-O?
- Message-ID: <KERS.92Sep3101340@cdollin.hpl.hp.com>
- Organization: Hewlett-Packard Laboratories, Bristol, UK.
- Path: sparky!uunet!wupost!sdd.hp.com!scd.hp.com!hplextra!otter.hpl.hp.com!hpltoad!cdollin!kers
- Newsgroups: comp.object
- References: <KERS.92Aug26181137@cdollin.hpl.hp.com> <#6jn_y+.objsys@netcom.com> <KERS.92Sep2121520@cdollin.hpl.hp.com> <b2kn_3q.objsys@netc
- Sender: news@hplb.hpl.hp.com (Usenet News Administrator)
- Lines: 41
- In-Reply-To: objsys@netcom.com's message of 2 Sep 92 20:29:22 GMT
- Nntp-Posting-Host: cdollin.hpl.hp.com
-
- In article ... objsys@netcom.com (Bob Hathaway) writes:
-
-
- >| You seem to have latched on to some trivial static efficiency tricks and
- >| took them as the general case.
- > ... [Why me?] ...
-
- C++ and other statically (strongly) typed object-oriented languages do
- only switch on the first parameter; all other argument types must be
- contra-variant with respect to subtyping. C++ even forces argument
- types (and currently return types) to be the same [for virtual functions].
- This is close to what you said: "only the first argument type is used and
- the rest are ignored". This is also a trivial static efficiency trick.
- This is what I was referring to above, the other case of a statically
- typeless language (Smalltalk) also only switches on the first argument type
- but includes keywords in the matching. This is because Smalltalk is a
- prototype language and doesn't provide types for argument matching (and
- only keywords, it should be both); a weakness of Smalltalk and clearly not
- of OO or of the O M ... notation.
-
- Hmm. The keywords in SmallTalk are just part of the message name, so I don't
- think they matter from the point of view of types; but that may depend on how
- you carve up your object orientation.
-
- It's never been clear to me whether you've been arguing from the *descriptive*
- stance (``this is how certain languages *are*''), the *prescriptive* stance
- (``this is is how languages *should be*''), or the *analytic* stance (subcase
- of descriptive; ``this is how languages *could be seen*'').
-
- Thus, C++ and other statically typed OO languages *do* only dispatch on one
- (the ``first'') argument [anyone have a counter-example?], but they *need not*
- -- that is, static typing does not conflict with many-arg dispatch. And, in
- fact, I don't think it's a ``trivial static efficiency trick'' -- given the (a)
- alternative, such as CLOS-style multi-methods, which are quite hard to
- implement efficiently in the general case, it's a rather elegant solution.
-
- It's just that it's not the solution that some of us want ...
- --
-
- Regards | "Always code as if the guy who ends up maintaining your code will be
- Kers. | a violent psychopath who knows where you live." - John F. Woods
-