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: 103376,dbcfe2b0a74da57e X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news2.google.com!news.glorb.com!newscon02.news.prodigy.net!prodigy.net!newsfeed-00.mathworks.com!nntp.TheWorld.com!not-for-mail From: Robert A Duff Newsgroups: comp.lang.ada Subject: Re: Inherited Methods and such Date: Fri, 28 Sep 2007 15:12:51 -0400 Organization: The World Public Access UNIX, Brookline, MA Message-ID: References: <1190296353.624737.150940@y42g2000hsy.googlegroups.com> <11m13st1f92kf$.m8s6y8mc8ebk.dlg@40tude.net> <1190321119.206313.65290@57g2000hsv.googlegroups.com> <1190408526.100291.265040@50g2000hsm.googlegroups.com> <9ukf2wtqjs0q$.iuijmal4x56b$.dlg@40tude.net> <1190497995.498679.119190@19g2000hsx.googlegroups.com> <1mw3qju08q8uj.sgzht7ld9ydc$.dlg@40tude.net> <1190579805.451187.71140@d55g2000hsg.googlegroups.com> <1i8ksr774bjbj.vpmnx3c0i9qz.dlg@40tude.net> <1190646125.024072.310020@19g2000hsx.googlegroups.com> <1r9s9v6pcjifl.vp4ktk0unpd1.dlg@40tude.net> <1190753631.240548.101820@19g2000hsx.googlegroups.com> <1190843408.713838.128690@g4g2000hsf.googlegroups.com> <1190928238.269866.53270@o80g2000hse.googlegroups.com> NNTP-Posting-Host: shell01.theworld.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: pcls6.std.com 1191006779 24377 192.74.137.71 (28 Sep 2007 19:12:59 GMT) X-Complaints-To: abuse@TheWorld.com NNTP-Posting-Date: Fri, 28 Sep 2007 19:12:59 +0000 (UTC) User-Agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.3 (irix) Cancel-Lock: sha1:BZbjpu58LZgslmal5hjaNBrKI7o= Xref: g2news2.google.com comp.lang.ada:2197 Date: 2007-09-28T15:12:51-04:00 List-Id: Maciej Sobczak writes: > On 27 Wrz, 15:39, Robert A Duff wrote: >> But I find the C++ solution less than ideal -- the programmer might well >> expect to dispatch to the deeper type, and be surprised when it doesn't. > > Of course. I can assure you that this question is quite regular and > even has its own FAQ entry: > > http://www.parashift.com/c++-faq-lite/strange-inheritance.html#faq-23.5 > >> Question: why do you want to dispatch at all during construction? > > I don't. OK, good. So neither C++ nor Ada is ideal here, because both allow dispatching during construction. (And for Initialize, Ada is arguably worse than C++, since it allows dispatching to the deeper type.) > Yes, but this was taken out of some fragment of this lengthy > discussion. Registration requires that T'Class is available in the > base type constructor. > > So - even if I don't need to dispatch, I might need T'Class. Interesting. I'm not sure what the best language design would be, for this sort of thing. >> In other words, would you be happy with a rule saying you can't dispatch >> during construction? > > I would be perfectly fine with this rule, but having this rule *and* > access to T'Class are not much compatible with each other. Indeed. >... How can you > prevent me from dispatching if I already have T'Class? With runtime > checks, perhaps? In the Ada context, a run-time check is the only way I can think of. - Bob