Path: csiph.com!xmission!news.snarked.org!border2.nntp.dca1.giganews.com!nntp.giganews.com!news.iecc.com!.POSTED.news.iecc.com!nerds-end From: Hans-Peter Diettrich Newsgroups: comp.compilers Subject: Re: OOP language design after Algol 60, was Add nested-function support Date: Fri, 13 Apr 2018 10:22:03 +0200 Organization: Compilers Central Lines: 47 Sender: news@iecc.com Approved: comp.compilers@iecc.com Message-ID: <18-04-057@comp.compilers> References: <49854345-f940-e82a-5c35-35078c4189d5@gkc.org.uk> <18-03-103@comp.compilers> <18-03-042@comp.compilers> <18-03-047@comp.compilers> <18-03-075@comp.compilers> <18-03-079@comp.compilers> <18-03-101@comp.compilers> <18-04-002@comp.compilers> <18-04-003@comp.compilers> <18-04-004@comp.compilers> <18-04-024@comp.compilers> <18-04-034@comp.compilers> <18-04-041@comp.compilers> <18-04-051@comp.compilers> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: gal.iecc.com; posting-host="news.iecc.com:2001:470:1f07:1126:0:676f:7373:6970"; logging-data="99286"; mail-complaints-to="abuse@iecc.com" Keywords: OOP, design Posted-Date: 13 Apr 2018 13:18:17 EDT X-submission-address: compilers@iecc.com X-moderator-address: compilers-request@iecc.com X-FAQ-and-archives: http://compilers.iecc.com Xref: csiph.com comp.compilers:2072 Am 13.04.2018 um 02:51 schrieb George Neuner: > On Thu, 12 Apr 2018 01:09:42 +0200, Hans-Peter Diettrich > wrote: > >> Am 10.04.2018 um 20:32 schrieb George Neuner: >>> On Tue, 10 Apr 2018 05:48:43 GMT, anton@mips.complang.tuwien.ac.at >>> (Anton Ertl) wrote: >> >>> Smalltalk had/has single inheritence only, and it's dynamic dispatch >>> mechanism is very different from that of C++. >> >> Isn't *multiple inheritance* one of the features that C++ proved >> impractical? Which other languages support multiple inheritance? > > No. It proved only that C++ wasn't able to accomodate conflicting > classes effectively. Lisp handles this same problem much more > effectively, so it isn't a generic fault of MI. > > Moreover, most (all?) SI languages implement interfaces (abstract > classes). Interfaces mainly are a workaround for lacking real MI, so > why would they do that if it were useless? Interfaces don't have all the problems arising from multiple inheritance. I can see only the disadvantage, that duplicate code may be required to implement the same interface in multiple classes. But see below... I've learned to distinguish class aggregation and composition by asking whether it *is* something, or *has* something. A house *has* a roof, but it *isn't* a roof, so it does not inherit from a roof class. This way I never felt a need for multiple inheritance in my programs. But perhaps outside my restricted experience there exist other needs... > It often is the case that a subclass has to reimplement something from > one of its ancestors, and it *might* be the case with MI that there is > a clash wrt handling something that has to be worked around. But > using interfaces, it is *guaranteed* that you will have to > (re)implement not just things that conflict, but everything in the > interface. An interface can be implemented by a (class type) component of a class. Then only the specific dependencies between both classes have to be implemented explicitly. In Delphi the "implements" keyword implements such object delegation, in addition to method delegation. DoDi