Path: csiph.com!weretis.net!feeder6.news.weretis.net!feeder.usenetexpress.com!feeder-in1.iad1.usenetexpress.com!border1.nntp.dca1.giganews.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news.iecc.com!.POSTED.news.iecc.com!nerds-end From: Kaz Kylheku <157-073-9834@kylheku.com> Newsgroups: comp.compilers Subject: Re: OOP language design after Algol 60, was Add nested-function support Date: Fri, 13 Apr 2018 03:22:10 +0000 (UTC) Organization: Aioe.org NNTP Server Lines: 68 Sender: news@iecc.com Approved: comp.compilers@iecc.com Message-ID: <18-04-054@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> Injection-Info: gal.iecc.com; posting-host="news.iecc.com:2001:470:1f07:1126:0:676f:7373:6970"; logging-data="98559"; mail-complaints-to="abuse@iecc.com" Keywords: OOP, design Posted-Date: 13 Apr 2018 13:16:29 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:2070 On 2018-04-13, George Neuner wrote: > 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. More problematic than the lexical conflicts is the whole business of "virtual inheritance". If you don't use it, you end up with with multiple copies of the same bases via different paths in the multiple inheritance DAG. It all has to do with the specification of C++ inheritance (and everything else) being motivated by a specific locus of implementations: how it works at the memory layout level with specific pointers, offsets, tables and whatnot. Before the C++ people specify anything, they first have to ensure that some relatively cheap and fast mechanism can handle it at run-time. That then guides how the specification is written, even if it is not explicitly in the wording. > 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? Are they? Interfaces are only a workaround for lack of MI if you take it for granted that a class must *declare* inheritance from B before its instances are permitted to be substituted wherever a B may be used. If you do not take that for granted, then you don't need inheritance at all. In the Common Lisp object system that you mentioned, we can easily specialize the same method to string or integer, even though those are not related by inheritance. We just: (defmethod foo ((arg integer)) ...) (defmethod foo ((arg string)) ...) The integer and string classes doesn't have to have a declaration injected into them which them allows their instances to appear as obj in (foo obj) calls. So *that* motivation for MI is absent: we can take any class or classes, and just use them in multiple method-based protocols; as many as we want. -- TXR Programming Lanuage: http://nongnu.org/txr Music DIY Mailing List: http://www.kylheku.com/diy ADA MP-1 Mailing List: http://www.kylheku.com/mp1