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,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.182.28.37 with SMTP id y5mr4639334obg.9.1413061788404; Sat, 11 Oct 2014 14:09:48 -0700 (PDT) X-Received: by 10.140.37.39 with SMTP id q36mr174qgq.10.1413061788298; Sat, 11 Oct 2014 14:09:48 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!news.glorb.com!uq10no8843341igb.0!news-out.google.com!i10ni83qaf.0!nntp.google.com!s7no2055559qap.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Sat, 11 Oct 2014 14:09:48 -0700 (PDT) In-Reply-To: <1m1grtt4tjy6m$.2tgdf5cel9tn$.dlg@40tude.net> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=206.53.78.59; posting-account=ShYTIAoAAABytvcS76ZrG9GdaV-nXYKy NNTP-Posting-Host: 206.53.78.59 References: <8d6fe2a6-a8fa-441f-8b35-fc5a744359fb@googlegroups.com> <1m1grtt4tjy6m$.2tgdf5cel9tn$.dlg@40tude.net> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <1d5e857d-1c16-40be-9f4d-fba44ce22e42@googlegroups.com> Subject: Re: Type extension and discriminants From: sbelmont700@gmail.com Injection-Date: Sat, 11 Oct 2014 21:09:48 +0000 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Xref: news.eternal-september.org comp.lang.ada:22353 Date: 2014-10-11T14:09:48-07:00 List-Id: On Saturday, October 11, 2014 2:53:05 PM UTC-4, Dmitry A. Kazakov wrote: >=20 > Don't use this pattern, it simply does not work. Even without GNAT bugs. >=20 > However all GNAT compilers I know have serious problems with more than on= e >=20 > nested limited return. But if GNAT worked, this pattern will eventually h= it >=20 > you back. >=20 The issue of favoring composition over inheritance is that if T1 has lots o= f operations, especially those which are unchanged (not overridden) for T2 = (and T3, and T4, etc), then you end up with the hassle of writing all these= one-line delegation methods. It's easy enough to refactor this so that T1= and T2 both implement interface I, have T2 contain a reference to a T1 and= just pass the calls through, but apart from being a PITA and unnecessary, = often the compile-time safety is an advantage, not a drawback; any T2 is fo= rced to use T1's (classwide) methods, and can NOT be reconfigured dynamical= ly. Obviously this a case-by-case sort of thing, but this is certainly a p= attern any purportedly OOP language needs to support. >=20 >=20 > In short, limited return (constructing function) and limited aggregate ar= e >=20 > not suitable for construction of parent objects which private discriminan= ts >=20 > and components. >=20 +1(000). This is especially aggravating, because Ada's access discriminant= s and pass-by-reference semantics are so totally superior for saving refere= nces to other objects without having to resort to the heap. But the interm= ixing of "true" discriminated records (i.e. variant records, where the stru= cture actually depends on the discriminant), and "fake" discriminated recor= ds that just use them when they need a constant always seems to cause endle= ss headaches. I just wish I had a better idea of how to do it, because C++= initializer lists are a syntax abomination. :'-( -sb