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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,dea2d62ab1462538 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!proxad.net!feeder1-2.proxad.net!news.in2p3.fr!in2p3.fr!news.ecp.fr!news.jacob-sparre.dk!pnx.dk!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Writing an Operating System in Ada Date: Thu, 14 Jan 2010 19:24:41 -0600 Organization: Jacob Sparre Andersen Message-ID: References: <8e9bc311-7540-40a1-b19e-49e93648c25c@s31g2000yqs.googlegroups.com> <9oyblld05omh$.1dzhmyoseeb7x$.dlg@40tude.net> <414945fd-8ed5-4f42-a237-0685602332b3@f5g2000yqh.googlegroups.com> <1c1x49re1atv3$.kxickttntzsn$.dlg@40tude.net> <26325363-b456-4c8f-a51d-4e87ef789619@a15g2000yqm.googlegroups.com> <754366b4-08c9-400b-b883-183e71dddd0b@35g2000yqa.googlegroups.com> <1fhgwtz4ezt52.zvep41elk4lq.dlg@40tude.net> NNTP-Posting-Host: static-69-95-181-76.mad.choiceone.net X-Trace: munin.nbi.dk 1263518683 17528 69.95.181.76 (15 Jan 2010 01:24:43 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Fri, 15 Jan 2010 01:24:43 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5843 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579 Xref: g2news1.google.com comp.lang.ada:8762 Date: 2010-01-14T19:24:41-06:00 List-Id: "Dmitry A. Kazakov" wrote in message news:1fhgwtz4ezt52.zvep41elk4lq.dlg@40tude.net... > On Thu, 14 Jan 2010 13:07:08 -0800 (PST), Shark8 wrote: ... >>> You have to be able to derive from a task, that is what active objects >>> are. >>> BTW, you already can do this in Ada 2005. It has task interfaces, but >>> this >>> inheritance is limited to have the depth of 1. >> >> I remember reading that now... but is an inheritance level of 1 good >> enough? > > No, it is not. The bottom level is an interface, a quite useless thing > because it does not provide implementation. The next level is a concrete > implementation. The train stops there. You're confusing inheritance of interfaces with inheritance of implementation. One of the most important parts of Ada is that it tries to strongly separate interfaces and implementation. [I know you know this difference, but are purposely ignoring it.] You can have as much inheritance of interfaces as you want (as you showed in your read/write example). Ada doesn't allow inheritance of implementation for synchronized objects, for the very good reason that no one knows how to make inheritance rules that doesn't violate the exclusion and ordering rules. We tried for a quite a while to make a version of inheritable protected types, but it always led to deadlocks, race conditions, or loss of exclusion. (Java has this problem in spades.) We looked at some ideas for very limited inheritance, but it would have been quite complex. We didn't think anyone would understand the rules (they surely were not intuitive). By not allowing inheritance at all, we keep all of the mutual exclusion in a single object where analysing it for problems is at least possible. Since subprogram calls are possible for the sequential code, it doesn't necessarily have to be duplicated (although most of the synchronized interface objects that we see are quite simple, as anything complex is pretty much a lost cause at the start). Someday the state of the art might change; by not doing anything in Ada 2005 we left open the possibility for doing it right (whatever that turns out to mean) in the future; had we done a lousy job in 2005, we couldn't have replaced it in the future without breaking a lot of existing code (which we won't do). Randy.